"""
Alpha101因子库核心实现
===================

Alpha101Factory是主要的因子工厂类，负责创建和计算所有101个Alpha因子。
"""

import numpy as np
from typing import Dict, List, Optional, Union, Any
import warnings
from .config import ALPHA_CONFIG, get_factor_config, validate_factor_config
from .operators import BaseOperators, CrossSectionOps

# 尝试导入numba，如果不可用则使用纯Python版本
try:
    from numba import jit, prange
    NUMBA_AVAILABLE = True
except ImportError:
    warnings.warn("Numba not available, using pure Python implementation. "
                  "Install numba for better performance: pip install numba")
    NUMBA_AVAILABLE = False
    # 定义空装饰器
    def jit(*args, **kwargs):
        def decorator(func):
            return func
        return decorator
    
    def prange(x):
        return range(x)


class Alpha101Factory:
    """
    Alpha101因子工厂类
    
    负责创建、管理和计算所有101个Alpha因子。
    """
    
    def __init__(self, use_numba: bool = True):
        """
        初始化Alpha101工厂
        
        Parameters:
        -----------
        use_numba : bool
            是否使用Numba加速（如果可用）
        """
        self.use_numba = use_numba and NUMBA_AVAILABLE
        self.operators = BaseOperators()
        self.cross_ops = CrossSectionOps()
        self._compiled_factors = {}  # 缓存编译后的因子函数
        
        if not NUMBA_AVAILABLE and use_numba:
            warnings.warn("Numba requested but not available. Using pure Python.")
    
    def list_available_factors(self) -> List[str]:
        """
        列出所有可用的因子
        
        Returns:
        --------
        List[str]
            因子ID列表
        """
        return list(ALPHA_CONFIG.keys())
    
    def get_factor_info(self, factor_id: str) -> Dict[str, Any]:
        """
        获取因子信息
        
        Parameters:
        -----------
        factor_id : str
            因子ID
            
        Returns:
        --------
        Dict[str, Any]
            因子配置信息
        """
        return get_factor_config(factor_id)
    
    def validate_data(self, data: Dict[str, np.ndarray], factor_id: str) -> bool:
        """
        验证输入数据是否满足因子计算要求
        
        Parameters:
        -----------
        data : Dict[str, np.ndarray]
            输入数据字典
        factor_id : str
            因子ID
            
        Returns:
        --------
        bool
            数据是否有效
        """
        config = get_factor_config(factor_id)
        dependencies = config['dependencies']
        
        # 检查必需的数据字段
        for dep in dependencies:
            if dep not in data:
                raise ValueError(f"Missing required data field: {dep}")
            
            if not isinstance(data[dep], np.ndarray):
                raise TypeError(f"Data field {dep} must be numpy array")
            
            if data[dep].ndim != 2:
                raise ValueError(f"Data field {dep} must be 2D array (n_stocks, n_days)")
        
        # 检查数据形状一致性
        shapes = [data[dep].shape for dep in dependencies]
        if not all(shape == shapes[0] for shape in shapes):
            raise ValueError("All data fields must have the same shape")
        
        # 检查最小时间长度
        min_periods = config.get('min_periods', config['window'])
        if shapes[0][1] < min_periods:
            raise ValueError(f"Insufficient data length. Need at least {min_periods} periods")
        
        return True
    
    def compute_factor(self, factor_id: str, data: Dict[str, np.ndarray], 
                      **kwargs) -> np.ndarray:
        """
        计算指定因子
        
        Parameters:
        -----------
        factor_id : str
            因子ID
        data : Dict[str, np.ndarray]
            输入数据字典，每个数组形状为(n_stocks, n_days)
        **kwargs
            额外参数
            
        Returns:
        --------
        np.ndarray
            因子值，形状为(n_stocks, n_days)
        """
        # 验证因子ID
        if factor_id not in ALPHA_CONFIG:
            raise ValueError(f"Unknown factor ID: {factor_id}")
        
        # 验证数据
        self.validate_data(data, factor_id)
        
        # 获取因子配置
        config = get_factor_config(factor_id)
        
        # 预处理数据（计算衍生字段）
        processed_data = self._preprocess_data(data)
        
        # 调用具体的因子计算函数
        method_name = f"_compute_{factor_id}"
        if hasattr(self, method_name):
            factor_func = getattr(self, method_name)
            result = factor_func(processed_data, **kwargs)
        else:
            raise NotImplementedError(f"Factor {factor_id} not implemented yet")
        
        # 后处理
        result = self._postprocess_factor(result, config, **kwargs)
        
        return result
    
    def batch_compute(self, factor_ids: List[str], data: Dict[str, np.ndarray],
                     **kwargs) -> Dict[str, np.ndarray]:
        """
        批量计算多个因子
        
        Parameters:
        -----------
        factor_ids : List[str]
            因子ID列表
        data : Dict[str, np.ndarray]
            输入数据字典
        **kwargs
            额外参数
            
        Returns:
        --------
        Dict[str, np.ndarray]
            因子值字典
        """
        results = {}
        processed_data = self._preprocess_data(data)
        
        for factor_id in factor_ids:
            try:
                results[factor_id] = self.compute_factor(factor_id, data, **kwargs)
            except Exception as e:
                warnings.warn(f"Failed to compute {factor_id}: {str(e)}")
                results[factor_id] = None
        
        return results
    
    def _preprocess_data(self, data: Dict[str, np.ndarray]) -> Dict[str, np.ndarray]:
        """
        预处理数据，计算常用的衍生字段
        
        Parameters:
        -----------
        data : Dict[str, np.ndarray]
            原始数据
            
        Returns:
        --------
        Dict[str, np.ndarray]
            包含衍生字段的数据
        """
        processed = data.copy()
        
        # 计算收益率
        if 'close' in data and 'returns' not in processed:
            processed['returns'] = self._compute_returns(data['close'])
        
        # 计算VWAP（如果没有提供）
        if 'vwap' not in processed and all(k in data for k in ['high', 'low', 'close', 'volume']):
            processed['vwap'] = self._compute_vwap(data['high'], data['low'], 
                                                  data['close'], data['volume'])
        
        # 计算20日平均成交量
        if 'volume' in data and 'adv20' not in processed:
            processed['adv20'] = self.operators.ts_mean(data['volume'], 20)
        
        return processed
    
    def _compute_returns(self, close: np.ndarray) -> np.ndarray:
        """计算收益率"""
        return self.operators.delta(close, 1) / self.operators.delay(close, 1)
    
    def _compute_vwap(self, high: np.ndarray, low: np.ndarray, 
                     close: np.ndarray, volume: np.ndarray) -> np.ndarray:
        """计算VWAP（简化版本）"""
        typical_price = (high + low + close) / 3.0
        return typical_price  # 简化实现
    
    def _postprocess_factor(self, factor_values: np.ndarray, config: Dict[str, Any],
                           **kwargs) -> np.ndarray:
        """
        因子后处理
        
        Parameters:
        -----------
        factor_values : np.ndarray
            原始因子值
        config : Dict[str, Any]
            因子配置
        **kwargs
            额外参数
            
        Returns:
        --------
        np.ndarray
            处理后的因子值
        """
        result = factor_values.copy()
        
        # 去极值
        if config.get('winsorize', True) and kwargs.get('winsorize', True):
            limits = config.get('winsorize_limits', (0.025, 0.975))
            result = self.cross_ops.winsorize(result, limits)
        
        # 标准化
        if config.get('standardize', True) and kwargs.get('standardize', True):
            result = self.cross_ops.scale(result)
        
        # 行业中性化（如果提供了行业数据）
        if (config.get('neutralize', True) and kwargs.get('neutralize', True) 
            and 'industry' in kwargs):
            result = self.cross_ops.neutralize(result, kwargs['industry'])
        
        return result
    
    # Alpha因子具体实现
    def _compute_alpha001(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#001: rank(ts_argmax(power(((returns < 0) ? stddev(returns, 20) : close), 2.), 5)) - 0.5
        """
        close = data['close']
        returns = data['returns']
        
        # 构建条件数组：当returns < 0时使用stddev(returns, 20)，否则使用close
        std_returns = self.operators.ts_std(returns, 20)
        condition = np.where(returns < 0, std_returns, close)
        
        # 平方
        powered = np.power(condition, 2.0)
        
        # 5日内最大值位置
        argmax_result = self.operators.ts_argmax(powered, 5)
        
        # 截面排序并减去0.5
        ranked = self.cross_ops.rank(argmax_result)
        
        return ranked - 0.5
    
    def _compute_alpha002(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#002: (-1 * correlation(rank(delta(log(volume), 2)), rank(((close - open) / open)), 6))
        """
        volume = data['volume']
        close = data['close']
        open_price = data['open']
        
        # delta(log(volume), 2)
        log_volume = np.log(np.maximum(volume, 1e-8))
        delta_log_vol = self.operators.delta(log_volume, 2)
        rank_delta_log_vol = self.cross_ops.rank(delta_log_vol)
        
        # (close - open) / open
        price_change = (close - open_price) / np.maximum(open_price, 1e-8)
        rank_price_change = self.cross_ops.rank(price_change)
        
        # 6日相关性
        corr = self.operators.ts_corr(rank_delta_log_vol, rank_price_change, 6)
        
        return -1.0 * corr
    
    def _compute_alpha003(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#003: (-1 * correlation(rank(open), rank(volume), 10))
        """
        open_price = data['open']
        volume = data['volume']
        
        rank_open = self.cross_ops.rank(open_price)
        rank_volume = self.cross_ops.rank(volume)
        
        corr = self.operators.ts_corr(rank_open, rank_volume, 10)
        
        return -1.0 * corr
    
    def _compute_alpha004(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#004: (-1 * ts_rank(rank(low), 9))
        """
        low = data['low']
        
        rank_low = self.cross_ops.rank(low)
        ts_rank_result = self.operators.ts_rank(rank_low, 9)
        
        return -1.0 * ts_rank_result
    
    def _compute_alpha005(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#005: rank((open - (sum(vwap, 10) / 10))) * (-1 * abs(rank((close - vwap))))
        """
        open_price = data['open']
        vwap = data['vwap']
        close = data['close']
        
        # sum(vwap, 10) / 10 = mean(vwap, 10)
        mean_vwap = self.operators.ts_mean(vwap, 10)
        
        # rank(open - mean_vwap)
        open_deviation = open_price - mean_vwap
        rank_open_dev = self.cross_ops.rank(open_deviation)
        
        # rank(close - vwap)
        close_deviation = close - vwap
        rank_close_dev = self.cross_ops.rank(close_deviation)
        
        # 组合
        result = rank_open_dev * (-1.0 * np.abs(rank_close_dev))
        
        return result
    
    def _compute_alpha006(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#006: (-1 * correlation(open, volume, 10))
        """
        open_price = data['open']
        volume = data['volume']
        
        corr = self.operators.ts_corr(open_price, volume, 10)
        
        return -1.0 * corr
    
    def _compute_alpha007(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#007: ((adv20 < volume) ? ((-1 * ts_rank(abs(delta(close, 7)), 60)) * sign(delta(close, 7))) : (-1))
        """
        volume = data['volume']
        close = data['close']
        adv20 = data['adv20']
        
        # delta(close, 7)
        delta_close = self.operators.delta(close, 7)
        
        # abs(delta(close, 7))
        abs_delta = np.abs(delta_close)
        
        # ts_rank(abs(delta(close, 7)), 60)
        ts_rank_abs = self.operators.ts_rank(abs_delta, 60)
        
        # sign(delta(close, 7))
        sign_delta = np.sign(delta_close)
        
        # 条件表达式
        condition = adv20 < volume
        result = np.where(condition,
                         (-1.0 * ts_rank_abs) * sign_delta,
                         -1.0)
        
        return result
    
    def _compute_alpha008(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#008: (-1 * rank(((sum(open, 5) * sum(returns, 5)) - delay((sum(open, 5) * sum(returns, 5)), 10))))
        """
        open_price = data['open']
        returns = data['returns']
        
        # sum(open, 5) * sum(returns, 5)
        sum_open = self.operators.ts_sum(open_price, 5)
        sum_returns = self.operators.ts_sum(returns, 5)
        product = sum_open * sum_returns
        
        # delay(..., 10)
        delayed_product = self.operators.delay(product, 10)
        
        # 差值
        diff = product - delayed_product
        
        # rank
        ranked = self.cross_ops.rank(diff)
        
        return -1.0 * ranked
    
    def _compute_alpha009(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#009: ((0 < ts_min(delta(close, 1), 5)) ? delta(close, 1) : ((ts_max(delta(close, 1), 5) < 0) ? delta(close, 1) : (-1 * delta(close, 1))))
        """
        close = data['close']
        
        # delta(close, 1)
        delta_close = self.operators.delta(close, 1)
        
        # ts_min(delta(close, 1), 5)
        ts_min_delta = self.operators.ts_min(delta_close, 5)
        
        # ts_max(delta(close, 1), 5)
        ts_max_delta = self.operators.ts_max(delta_close, 5)
        
        # 条件表达式
        condition1 = ts_min_delta > 0
        condition2 = ts_max_delta < 0
        
        result = np.where(condition1, delta_close,
                         np.where(condition2, delta_close, -1.0 * delta_close))
        
        return result
    
    def _compute_alpha010(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#010: rank(((0 < ts_min(delta(close, 1), 4)) ? delta(close, 1) : ((ts_max(delta(close, 1), 4) < 0) ? delta(close, 1) : (-1 * delta(close, 1)))))
        """
        close = data['close']
        
        # delta(close, 1)
        delta_close = self.operators.delta(close, 1)
        
        # ts_min(delta(close, 1), 4)
        ts_min_delta = self.operators.ts_min(delta_close, 4)
        
        # ts_max(delta(close, 1), 4)
        ts_max_delta = self.operators.ts_max(delta_close, 4)
        
        # 条件表达式
        condition1 = ts_min_delta > 0
        condition2 = ts_max_delta < 0
        
        conditional_result = np.where(condition1, delta_close,
                                    np.where(condition2, delta_close, -1.0 * delta_close))
        
        # rank
        result = self.cross_ops.rank(conditional_result)
        
        return result
    
    def _compute_alpha011(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#011: ((rank(ts_max((vwap - close), 3)) + rank(ts_min((vwap - close), 3))) * rank(delta(volume, 3)))
        """
        vwap = data['vwap']
        close = data['close']
        volume = data['volume']
        
        # vwap - close
        vwap_close_diff = vwap - close
        
        # ts_max((vwap - close), 3)
        ts_max_diff = self.operators.ts_max(vwap_close_diff, 3)
        rank_max = self.cross_ops.rank(ts_max_diff)
        
        # ts_min((vwap - close), 3)
        ts_min_diff = self.operators.ts_min(vwap_close_diff, 3)
        rank_min = self.cross_ops.rank(ts_min_diff)
        
        # delta(volume, 3)
        delta_vol = self.operators.delta(volume, 3)
        rank_delta_vol = self.cross_ops.rank(delta_vol)
        
        result = (rank_max + rank_min) * rank_delta_vol
        
        return result
    
    def _compute_alpha012(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#012: (sign(delta(volume, 1)) * (-1 * delta(close, 1)))
        """
        volume = data['volume']
        close = data['close']
        
        # delta(volume, 1)
        delta_vol = self.operators.delta(volume, 1)
        sign_delta_vol = np.sign(delta_vol)
        
        # delta(close, 1)
        delta_close = self.operators.delta(close, 1)
        
        result = sign_delta_vol * (-1.0 * delta_close)
        
        return result
    
    def _compute_alpha013(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#013: (-1 * rank(covariance(rank(close), rank(volume), 5)))
        """
        close = data['close']
        volume = data['volume']
        
        rank_close = self.cross_ops.rank(close)
        rank_volume = self.cross_ops.rank(volume)
        
        cov = self.operators.ts_cov(rank_close, rank_volume, 5)
        ranked_cov = self.cross_ops.rank(cov)
        
        return -1.0 * ranked_cov
    
    def _compute_alpha014(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#014: ((-1 * rank(delta(returns, 3))) * correlation(open, volume, 10))
        """
        returns = data['returns']
        open_price = data['open']
        volume = data['volume']
        
        # delta(returns, 3)
        delta_returns = self.operators.delta(returns, 3)
        rank_delta_returns = self.cross_ops.rank(delta_returns)
        
        # correlation(open, volume, 10)
        corr = self.operators.ts_corr(open_price, volume, 10)
        
        result = (-1.0 * rank_delta_returns) * corr
        
        return result
    
    def _compute_alpha015(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#015: (-1 * sum(rank(correlation(rank(high), rank(volume), 3)), 3))
        """
        high = data['high']
        volume = data['volume']
        
        rank_high = self.cross_ops.rank(high)
        rank_volume = self.cross_ops.rank(volume)
        
        # correlation(rank(high), rank(volume), 3)
        corr = self.operators.ts_corr(rank_high, rank_volume, 3)
        rank_corr = self.cross_ops.rank(corr)
        
        # sum(..., 3)
        sum_rank_corr = self.operators.ts_sum(rank_corr, 3)
        
        return -1.0 * sum_rank_corr
    
    def _compute_alpha016(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#016: (-1 * rank(covariance(rank(high), rank(volume), 5)))
        """
        high = data['high']
        volume = data['volume']
        
        rank_high = self.cross_ops.rank(high)
        rank_volume = self.cross_ops.rank(volume)
        
        cov = self.operators.ts_cov(rank_high, rank_volume, 5)
        ranked_cov = self.cross_ops.rank(cov)
        
        return -1.0 * ranked_cov
    
    def _compute_alpha017(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#017: (((-1 * rank(ts_rank(close, 10))) * rank(delta(delta(close, 1), 1))) * rank(ts_rank((volume / adv20), 5)))
        """
        close = data['close']
        volume = data['volume']
        adv20 = data['adv20']
        
        # ts_rank(close, 10)
        ts_rank_close = self.operators.ts_rank(close, 10)
        rank_ts_rank_close = self.cross_ops.rank(ts_rank_close)
        
        # delta(delta(close, 1), 1)
        delta_close = self.operators.delta(close, 1)
        delta_delta_close = self.operators.delta(delta_close, 1)
        rank_delta_delta = self.cross_ops.rank(delta_delta_close)
        
        # volume / adv20
        vol_ratio = volume / np.maximum(adv20, 1e-8)
        ts_rank_vol_ratio = self.operators.ts_rank(vol_ratio, 5)
        rank_ts_rank_vol = self.cross_ops.rank(ts_rank_vol_ratio)
        
        result = ((-1.0 * rank_ts_rank_close) * rank_delta_delta) * rank_ts_rank_vol
        
        return result
    
    def _compute_alpha018(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#018: (-1 * rank(((stddev(abs((close - open)), 5) + (close - open)) + correlation(close, open, 10))))
        """
        close = data['close']
        open_price = data['open']
        
        # close - open
        close_open_diff = close - open_price
        
        # abs(close - open)
        abs_diff = np.abs(close_open_diff)
        
        # stddev(abs((close - open)), 5)
        std_abs_diff = self.operators.ts_std(abs_diff, 5)
        
        # correlation(close, open, 10)
        corr = self.operators.ts_corr(close, open_price, 10)
        
        # 组合
        combined = std_abs_diff + close_open_diff + corr
        ranked = self.cross_ops.rank(combined)
        
        return -1.0 * ranked
    
    def _compute_alpha019(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#019: ((-1 * sign(((close - delay(close, 7)) + delta(close, 7)))) * (1 + rank((1 + sum(returns, 250)))))
        """
        close = data['close']
        returns = data['returns']
        
        # 获取数据长度，如果不足250天，使用可用的最大长度
        n_days = close.shape[1]
        sum_window = min(250, max(20, n_days - 10))  # 至少20天，最多250天
        
        # close - delay(close, 7)
        delayed_close = self.operators.delay(close, 7)
        close_diff = close - delayed_close
        
        # delta(close, 7)
        delta_close = self.operators.delta(close, 7)
        
        # sign((close - delay(close, 7)) + delta(close, 7))
        combined_diff = close_diff + delta_close
        sign_combined = np.sign(combined_diff)
        
        # sum(returns, window) - 使用调整后的窗口
        sum_returns = self.operators.ts_sum(returns, sum_window)
        
        # 1 + sum(returns, window)
        one_plus_sum = 1.0 + sum_returns
        rank_one_plus_sum = self.cross_ops.rank(one_plus_sum)
        
        # 1 + rank(...)
        one_plus_rank = 1.0 + rank_one_plus_sum
        
        result = (-1.0 * sign_combined) * one_plus_rank
        
        return result
    
    def _compute_alpha020(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#020: (((-1 * rank((open - delay(high, 1)))) * rank((open - delay(close, 1)))) * rank((open - delay(low, 1))))
        """
        open_price = data['open']
        high = data['high']
        close = data['close']
        low = data['low']
        
        # open - delay(high, 1)
        delayed_high = self.operators.delay(high, 1)
        open_high_diff = open_price - delayed_high
        rank_open_high = self.cross_ops.rank(open_high_diff)
        
        # open - delay(close, 1)
        delayed_close = self.operators.delay(close, 1)
        open_close_diff = open_price - delayed_close
        rank_open_close = self.cross_ops.rank(open_close_diff)
        
        # open - delay(low, 1)
        delayed_low = self.operators.delay(low, 1)
        open_low_diff = open_price - delayed_low
        rank_open_low = self.cross_ops.rank(open_low_diff)
        
        result = ((-1.0 * rank_open_high) * rank_open_close) * rank_open_low
        
        return result
    
    def _compute_alpha021(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#021: ((((sum(close, 8) / 8) + stddev(close, 8)) < (sum(close, 2) / 2)) ? (-1) : (((sum(close, 2) / 2) < ((sum(close, 8) / 8) - stddev(close, 8))) ? 1 : (((1 < (volume / adv20)) || ((volume / adv20) == 1)) ? 1 : (-1))))
        """
        close = data['close']
        volume = data['volume']
        adv20 = data['adv20']
        
        # sum(close, 8) / 8
        mean_close_8 = self.operators.ts_mean(close, 8)
        
        # stddev(close, 8)
        std_close_8 = self.operators.ts_std(close, 8)
        
        # sum(close, 2) / 2
        mean_close_2 = self.operators.ts_mean(close, 2)
        
        # volume / adv20
        vol_ratio = volume / np.maximum(adv20, 1e-8)
        
        # 条件1: (mean_close_8 + std_close_8) < mean_close_2
        condition1 = (mean_close_8 + std_close_8) < mean_close_2
        
        # 条件2: mean_close_2 < (mean_close_8 - std_close_8)
        condition2 = mean_close_2 < (mean_close_8 - std_close_8)
        
        # 条件3: (vol_ratio > 1) or (vol_ratio == 1)
        condition3 = vol_ratio >= 1
        
        result = np.where(condition1, -1.0,
                         np.where(condition2, 1.0,
                                 np.where(condition3, 1.0, -1.0)))
        
        return result
    
    def _compute_alpha022(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#022: (-1 * (delta(correlation(high, volume, 5), 5) * rank(stddev(close, 20))))
        """
        high = data['high']
        volume = data['volume']
        close = data['close']
        
        # correlation(high, volume, 5)
        corr = self.operators.ts_corr(high, volume, 5)
        
        # delta(correlation(...), 5)
        delta_corr = self.operators.delta(corr, 5)
        
        # stddev(close, 20)
        std_close = self.operators.ts_std(close, 20)
        rank_std = self.cross_ops.rank(std_close)
        
        result = -1.0 * (delta_corr * rank_std)
        
        return result
    
    def _compute_alpha023(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#023: (((sum(high, 20) / 20) < high) ? (-1 * delta(high, 2)) : 0)
        """
        high = data['high']
        
        # sum(high, 20) / 20
        mean_high_20 = self.operators.ts_mean(high, 20)
        
        # delta(high, 2)
        delta_high = self.operators.delta(high, 2)
        
        # 条件表达式
        condition = mean_high_20 < high
        result = np.where(condition, -1.0 * delta_high, 0.0)
        
        return result
    
    def _compute_alpha024(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#024: ((((delta((sum(close, 100) / 100), 100) / delay(close, 100)) < 0.05) || ((delta((sum(close, 100) / 100), 100) / delay(close, 100)) == 0.05)) ? (-1 * (close - ts_min(close, 100))) : (-1 * delta(close, 3)))
        """
        close = data['close']
        
        # sum(close, 100) / 100
        mean_close_100 = self.operators.ts_mean(close, 100)
        
        # delta(mean_close_100, 100)
        delta_mean = self.operators.delta(mean_close_100, 100)
        
        # delay(close, 100)
        delayed_close = self.operators.delay(close, 100)
        
        # delta(...) / delay(close, 100)
        ratio = delta_mean / np.maximum(delayed_close, 1e-8)
        
        # ts_min(close, 100)
        min_close = self.operators.ts_min(close, 100)
        
        # delta(close, 3)
        delta_close = self.operators.delta(close, 3)
        
        # 条件表达式
        condition = ratio <= 0.05
        result = np.where(condition,
                         -1.0 * (close - min_close),
                         -1.0 * delta_close)
        
        return result
    
    def _compute_alpha025(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#025: rank(((((-1 * returns) * adv20) * vwap) * (high - close)))
        """
        returns = data['returns']
        adv20 = data['adv20']
        vwap = data['vwap']
        high = data['high']
        close = data['close']
        
        # (-1 * returns) * adv20 * vwap * (high - close)
        result_value = ((-1.0 * returns) * adv20) * vwap * (high - close)
        
        # rank
        ranked = self.cross_ops.rank(result_value)
        
        return ranked
    
    def _compute_alpha026(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#026: (-1 * ts_max(correlation(ts_rank(volume, 5), ts_rank(high, 5), 5), 3))
        """
        volume = data['volume']
        high = data['high']
        
        # ts_rank(volume, 5)
        ts_rank_volume = self.operators.ts_rank(volume, 5)
        
        # ts_rank(high, 5)
        ts_rank_high = self.operators.ts_rank(high, 5)
        
        # correlation(ts_rank(volume, 5), ts_rank(high, 5), 5)
        corr = self.operators.ts_corr(ts_rank_volume, ts_rank_high, 5)
        
        # ts_max(..., 3)
        ts_max_corr = self.operators.ts_max(corr, 3)
        
        return -1.0 * ts_max_corr
    
    def _compute_alpha027(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#027: ((0.5 < rank((sum(correlation(rank(volume), rank(vwap), 6), 2) / 2.0))) ? (-1) : 1)
        """
        volume = data['volume']
        vwap = data['vwap']
        
        # rank(volume)
        rank_volume = self.cross_ops.rank(volume)
        
        # rank(vwap)
        rank_vwap = self.cross_ops.rank(vwap)
        
        # correlation(rank(volume), rank(vwap), 6)
        corr = self.operators.ts_corr(rank_volume, rank_vwap, 6)
        
        # sum(..., 2) / 2.0
        sum_corr = self.operators.ts_sum(corr, 2) / 2.0
        
        # rank(...)
        rank_sum_corr = self.cross_ops.rank(sum_corr)
        
        # 条件表达式
        condition = rank_sum_corr > 0.5
        result = np.where(condition, -1.0, 1.0)
        
        return result
    
    def _compute_alpha028(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#028: scale(((correlation(adv20, low, 5) + ((high + low) / 2)) - close))
        """
        adv20 = data['adv20']
        low = data['low']
        high = data['high']
        close = data['close']
        
        # correlation(adv20, low, 5)
        corr = self.operators.ts_corr(adv20, low, 5)
        
        # (high + low) / 2
        mid_price = (high + low) / 2.0
        
        # correlation(...) + mid_price - close
        combined = corr + mid_price - close
        
        # scale(...)
        result = self.cross_ops.scale(combined)
        
        return result
    
    def _compute_alpha029(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#029: (min(product(rank(rank(scale(log(sum(ts_min(rank(rank((-1 * rank(delta(close, 5))))), 2), 1))))), 1), 5) + ts_rank(delay((-1 * returns), 6), 5))
        """
        close = data['close']
        returns = data['returns']
        
        # delta(close, 5)
        delta_close = self.operators.delta(close, 5)
        
        # rank(delta(close, 5))
        rank_delta = self.cross_ops.rank(delta_close)
        
        # -1 * rank(...)
        neg_rank_delta = -1.0 * rank_delta
        
        # rank(rank(...))
        rank_rank_neg = self.cross_ops.rank(self.cross_ops.rank(neg_rank_delta))
        
        # ts_min(..., 2)
        ts_min_result = self.operators.ts_min(rank_rank_neg, 2)
        
        # sum(..., 1)
        sum_result = self.operators.ts_sum(ts_min_result, 1)
        
        # log(...)
        log_result = np.log(np.maximum(sum_result, 1e-8))
        
        # scale(...)
        scale_result = self.cross_ops.scale(log_result)
        
        # rank(rank(...))
        rank_rank_scale = self.cross_ops.rank(self.cross_ops.rank(scale_result))
        
        # product(..., 1) - 简化为直接使用数据
        product_result = rank_rank_scale
        
        # min(..., 5) - 使用ts_min
        min_result = self.operators.ts_min(product_result, 5)
        
        # delay((-1 * returns), 6)
        delayed_neg_returns = self.operators.delay(-1.0 * returns, 6)
        
        # ts_rank(..., 5)
        ts_rank_delayed = self.operators.ts_rank(delayed_neg_returns, 5)
        
        result = min_result + ts_rank_delayed
        
        return result
    
    def _compute_alpha030(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#030: (((1.0 - rank(((sign((close - delay(close, 1))) + sign((delay(close, 1) - delay(close, 2)))) + sign((delay(close, 2) - delay(close, 3)))))) * sum(volume, 5)) / sum(volume, 20))
        """
        close = data['close']
        volume = data['volume']
        
        # delay(close, 1), delay(close, 2), delay(close, 3)
        delayed_close_1 = self.operators.delay(close, 1)
        delayed_close_2 = self.operators.delay(close, 2)
        delayed_close_3 = self.operators.delay(close, 3)
        
        # sign((close - delay(close, 1)))
        sign1 = np.sign(close - delayed_close_1)
        
        # sign((delay(close, 1) - delay(close, 2)))
        sign2 = np.sign(delayed_close_1 - delayed_close_2)
        
        # sign((delay(close, 2) - delay(close, 3)))
        sign3 = np.sign(delayed_close_2 - delayed_close_3)
        
        # 三个符号相加
        sign_sum = sign1 + sign2 + sign3
        
        # rank(...)
        rank_sign_sum = self.cross_ops.rank(sign_sum)
        
        # 1.0 - rank(...)
        one_minus_rank = 1.0 - rank_sign_sum
        
        # sum(volume, 5)
        sum_vol_5 = self.operators.ts_sum(volume, 5)
        
        # sum(volume, 20)
        sum_vol_20 = self.operators.ts_sum(volume, 20)
        
        # 最终计算
        result = (one_minus_rank * sum_vol_5) / np.maximum(sum_vol_20, 1e-8)
        
        return result
    
    def _compute_alpha031(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#031: ((rank(rank(rank(decay_linear((-1 * rank(rank(delta(close, 10)))), 10)))) + rank((-1 * delta(close, 3)))) + sign(scale(correlation(adv20, low, 12))))
        """
        close = data['close']
        adv20 = data['adv20']
        low = data['low']
        
        # delta(close, 10)
        delta_close_10 = self.operators.delta(close, 10)
        
        # rank(rank(delta(close, 10)))
        rank_rank_delta = self.cross_ops.rank(self.cross_ops.rank(delta_close_10))
        
        # -1 * rank(rank(...))
        neg_rank_rank = -1.0 * rank_rank_delta
        
        # decay_linear(..., 10) - 使用简化版本
        decay_result = self.operators.ts_mean(neg_rank_rank, 10)  # 简化为均值
        
        # rank(rank(rank(...)))
        rank_rank_rank_decay = self.cross_ops.rank(self.cross_ops.rank(self.cross_ops.rank(decay_result)))
        
        # delta(close, 3)
        delta_close_3 = self.operators.delta(close, 3)
        
        # rank((-1 * delta(close, 3)))
        rank_neg_delta_3 = self.cross_ops.rank(-1.0 * delta_close_3)
        
        # correlation(adv20, low, 12)
        corr = self.operators.ts_corr(adv20, low, 12)
        
        # scale(correlation(...))
        scale_corr = self.cross_ops.scale(corr)
        
        # sign(scale(...))
        sign_scale_corr = np.sign(scale_corr)
        
        result = rank_rank_rank_decay + rank_neg_delta_3 + sign_scale_corr
        
        return result
    
    def _compute_alpha032(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#032: (scale(((sum(close, 7) / 7) - close)) + (20 * scale(correlation(vwap, delay(close, 5), 230))))
        """
        close = data['close']
        vwap = data['vwap']
        
        # 获取数据长度，如果不足230天，使用可用的最大长度
        n_days = close.shape[1]
        corr_window = min(230, max(20, n_days - 10))
        
        # sum(close, 7) / 7
        mean_close_7 = self.operators.ts_mean(close, 7)
        
        # (sum(close, 7) / 7) - close
        close_diff = mean_close_7 - close
        
        # scale(...)
        scale_close_diff = self.cross_ops.scale(close_diff)
        
        # delay(close, 5)
        delayed_close = self.operators.delay(close, 5)
        
        # correlation(vwap, delay(close, 5), window)
        corr = self.operators.ts_corr(vwap, delayed_close, corr_window)
        
        # scale(correlation(...))
        scale_corr = self.cross_ops.scale(corr)
        
        result = scale_close_diff + 20.0 * scale_corr
        
        return result
    
    def _compute_alpha033(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#033: rank((-1 * ((1 - (open / close))^1)))
        """
        open_price = data['open']
        close = data['close']
        
        # open / close
        open_close_ratio = open_price / np.maximum(close, 1e-8)
        
        # 1 - (open / close)
        one_minus_ratio = 1.0 - open_close_ratio
        
        # (1 - (open / close))^1 = 1 - (open / close)
        powered = one_minus_ratio
        
        # -1 * (...)
        neg_powered = -1.0 * powered
        
        # rank(...)
        result = self.cross_ops.rank(neg_powered)
        
        return result
    
    def _compute_alpha034(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#034: rank(((1 - rank((stddev(returns, 2) / stddev(returns, 5)))) + (1 - rank(delta(close, 1)))))
        """
        returns = data['returns']
        close = data['close']
        
        # stddev(returns, 2)
        std_returns_2 = self.operators.ts_std(returns, 2)
        
        # stddev(returns, 5)
        std_returns_5 = self.operators.ts_std(returns, 5)
        
        # stddev(returns, 2) / stddev(returns, 5)
        std_ratio = std_returns_2 / np.maximum(std_returns_5, 1e-8)
        
        # rank(...)
        rank_std_ratio = self.cross_ops.rank(std_ratio)
        
        # 1 - rank(...)
        one_minus_rank_std = 1.0 - rank_std_ratio
        
        # delta(close, 1)
        delta_close = self.operators.delta(close, 1)
        
        # rank(delta(close, 1))
        rank_delta_close = self.cross_ops.rank(delta_close)
        
        # 1 - rank(...)
        one_minus_rank_delta = 1.0 - rank_delta_close
        
        # 相加
        combined = one_minus_rank_std + one_minus_rank_delta
        
        # rank(...)
        result = self.cross_ops.rank(combined)
        
        return result
    
    def _compute_alpha035(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#035: ((ts_rank(volume, 32) * (1 - ts_rank(((close + high) - low), 16))) * (1 - ts_rank(returns, 32)))
        """
        volume = data['volume']
        close = data['close']
        high = data['high']
        low = data['low']
        returns = data['returns']
        
        # ts_rank(volume, 32)
        ts_rank_volume = self.operators.ts_rank(volume, 32)
        
        # (close + high) - low
        price_range = (close + high) - low
        
        # ts_rank(..., 16)
        ts_rank_price_range = self.operators.ts_rank(price_range, 16)
        
        # 1 - ts_rank(...)
        one_minus_rank_price = 1.0 - ts_rank_price_range
        
        # ts_rank(returns, 32)
        ts_rank_returns = self.operators.ts_rank(returns, 32)
        
        # 1 - ts_rank(returns, 32)
        one_minus_rank_returns = 1.0 - ts_rank_returns
        
        result = ts_rank_volume * one_minus_rank_price * one_minus_rank_returns
        
        return result
    
    def _compute_alpha036(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#036: (((((2.21 * rank(correlation(close, volume, 15))) + (0.7 * rank((open - close)))) + (0.73 * rank(ts_rank(delay((-1 * returns), 6), 5)))) + rank(abs(correlation(vwap, adv20, 6)))) + (0.6 * rank((((sum(close, 200) / 200) - open) * (close - open)))))
        """
        close = data['close']
        volume = data['volume']
        open_price = data['open']
        returns = data['returns']
        vwap = data['vwap']
        adv20 = data['adv20']
        
        # 获取数据长度，如果不足200天，使用可用的最大长度
        n_days = close.shape[1]
        sum_window = min(200, max(20, n_days - 10))
        
        # 2.21 * rank(correlation(close, volume, 15))
        corr_close_vol = self.operators.ts_corr(close, volume, 15)
        rank_corr_close_vol = self.cross_ops.rank(corr_close_vol)
        term1 = 2.21 * rank_corr_close_vol
        
        # 0.7 * rank((open - close))
        open_close_diff = open_price - close
        rank_open_close_diff = self.cross_ops.rank(open_close_diff)
        term2 = 0.7 * rank_open_close_diff
        
        # delay((-1 * returns), 6)
        delayed_neg_returns = self.operators.delay(-1.0 * returns, 6)
        
        # ts_rank(..., 5)
        ts_rank_delayed_returns = self.operators.ts_rank(delayed_neg_returns, 5)
        
        # 0.73 * rank(...)
        rank_ts_rank_returns = self.cross_ops.rank(ts_rank_delayed_returns)
        term3 = 0.73 * rank_ts_rank_returns
        
        # correlation(vwap, adv20, 6)
        corr_vwap_adv20 = self.operators.ts_corr(vwap, adv20, 6)
        
        # rank(abs(...))
        rank_abs_corr = self.cross_ops.rank(np.abs(corr_vwap_adv20))
        term4 = rank_abs_corr
        
        # sum(close, window) / window
        mean_close = self.operators.ts_mean(close, sum_window)
        
        # ((sum(close, window) / window) - open) * (close - open)
        price_momentum = (mean_close - open_price) * (close - open_price)
        
        # 0.6 * rank(...)
        rank_price_momentum = self.cross_ops.rank(price_momentum)
        term5 = 0.6 * rank_price_momentum
        
        result = term1 + term2 + term3 + term4 + term5
        
        return result
    
    def _compute_alpha037(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#037: (rank(correlation(delay((open - close), 1), close, 200)) + rank((open - close)))
        """
        open_price = data['open']
        close = data['close']
        
        # 获取数据长度，如果不足200天，使用可用的最大长度
        n_days = close.shape[1]
        corr_window = min(200, max(20, n_days - 10))
        
        # open - close
        open_close_diff = open_price - close
        
        # delay((open - close), 1)
        delayed_open_close_diff = self.operators.delay(open_close_diff, 1)
        
        # correlation(delay(...), close, window)
        corr = self.operators.ts_corr(delayed_open_close_diff, close, corr_window)
        
        # rank(correlation(...))
        rank_corr = self.cross_ops.rank(corr)
        
        # rank((open - close))
        rank_open_close_diff = self.cross_ops.rank(open_close_diff)
        
        result = rank_corr + rank_open_close_diff
        
        return result
    
    def _compute_alpha038(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#038: ((-1 * rank(ts_rank(close, 10))) * rank((close / open)))
        """
        close = data['close']
        open_price = data['open']
        
        # ts_rank(close, 10)
        ts_rank_close = self.operators.ts_rank(close, 10)
        
        # rank(ts_rank(close, 10))
        rank_ts_rank_close = self.cross_ops.rank(ts_rank_close)
        
        # -1 * rank(...)
        neg_rank_ts_rank = -1.0 * rank_ts_rank_close
        
        # close / open
        close_open_ratio = close / np.maximum(open_price, 1e-8)
        
        # rank((close / open))
        rank_close_open_ratio = self.cross_ops.rank(close_open_ratio)
        
        result = neg_rank_ts_rank * rank_close_open_ratio
        
        return result
    
    def _compute_alpha039(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#039: ((-1 * rank((delta(close, 7) * (1 - rank(decay_linear((volume / adv20), 9)))))) * (1 + rank(sum(returns, 250))))
        """
        close = data['close']
        volume = data['volume']
        adv20 = data['adv20']
        returns = data['returns']
        
        # 获取数据长度，如果不足250天，使用可用的最大长度
        n_days = close.shape[1]
        sum_window = min(250, max(20, n_days - 10))
        
        # delta(close, 7)
        delta_close = self.operators.delta(close, 7)
        
        # volume / adv20
        vol_ratio = volume / np.maximum(adv20, 1e-8)
        
        # decay_linear(..., 9) - 使用简化版本
        decay_vol_ratio = self.operators.ts_mean(vol_ratio, 9)
        
        # rank(decay_linear(...))
        rank_decay_vol = self.cross_ops.rank(decay_vol_ratio)
        
        # 1 - rank(...)
        one_minus_rank_decay = 1.0 - rank_decay_vol
        
        # delta(close, 7) * (1 - rank(...))
        delta_times_decay = delta_close * one_minus_rank_decay
        
        # rank(...)
        rank_delta_decay = self.cross_ops.rank(delta_times_decay)
        
        # -1 * rank(...)
        neg_rank_delta_decay = -1.0 * rank_delta_decay
        
        # sum(returns, window)
        sum_returns = self.operators.ts_sum(returns, sum_window)
        
        # rank(sum(...))
        rank_sum_returns = self.cross_ops.rank(sum_returns)
        
        # 1 + rank(...)
        one_plus_rank_returns = 1.0 + rank_sum_returns
        
        result = neg_rank_delta_decay * one_plus_rank_returns
        
        return result
    
    def _compute_alpha040(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#040: ((-1 * rank(stddev(high, 10))) * correlation(high, volume, 10))
        """
        high = data['high']
        volume = data['volume']
        
        # stddev(high, 10)
        std_high = self.operators.ts_std(high, 10)
        
        # rank(stddev(high, 10))
        rank_std_high = self.cross_ops.rank(std_high)
        
        # -1 * rank(...)
        neg_rank_std = -1.0 * rank_std_high
        
        # correlation(high, volume, 10)
        corr = self.operators.ts_corr(high, volume, 10)
        
        result = neg_rank_std * corr
        
        return result
    
    def _compute_alpha041(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#041: (((high * low)^0.5) - vwap)
        """
        high = data['high']
        low = data['low']
        vwap = data['vwap']
        
        # (high * low)^0.5
        geometric_mean = np.sqrt(high * low)
        
        # geometric_mean - vwap
        result = geometric_mean - vwap
        
        return result
    
    def _compute_alpha042(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#042: (rank((vwap - close)) / rank((vwap + close)))
        """
        vwap = data['vwap']
        close = data['close']
        
        # vwap - close
        vwap_close_diff = vwap - close
        
        # rank(vwap - close)
        rank_diff = self.cross_ops.rank(vwap_close_diff)
        
        # vwap + close
        vwap_close_sum = vwap + close
        
        # rank(vwap + close)
        rank_sum = self.cross_ops.rank(vwap_close_sum)
        
        # rank(...) / rank(...)
        result = rank_diff / np.maximum(rank_sum, 1e-8)
        
        return result
    
    def _compute_alpha043(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#043: (ts_rank((volume / adv20), 20) * ts_rank((-1 * delta(close, 7)), 8))
        """
        volume = data['volume']
        adv20 = data['adv20']
        close = data['close']
        
        # volume / adv20
        vol_ratio = volume / np.maximum(adv20, 1e-8)
        
        # ts_rank(..., 20)
        ts_rank_vol_ratio = self.operators.ts_rank(vol_ratio, 20)
        
        # delta(close, 7)
        delta_close = self.operators.delta(close, 7)
        
        # -1 * delta(close, 7)
        neg_delta_close = -1.0 * delta_close
        
        # ts_rank(..., 8)
        ts_rank_neg_delta = self.operators.ts_rank(neg_delta_close, 8)
        
        result = ts_rank_vol_ratio * ts_rank_neg_delta
        
        return result
    
    def _compute_alpha044(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#044: (-1 * correlation(high, rank(volume), 5))
        """
        high = data['high']
        volume = data['volume']
        
        # rank(volume)
        rank_volume = self.cross_ops.rank(volume)
        
        # correlation(high, rank(volume), 5)
        corr = self.operators.ts_corr(high, rank_volume, 5)
        
        result = -1.0 * corr
        
        return result
    
    def _compute_alpha045(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#045: (-1 * ((rank((sum(delay(close, 5), 20) / 20)) * correlation(close, volume, 2)) * rank(correlation(sum(close, 5), sum(close, 20), 2))))
        """
        close = data['close']
        volume = data['volume']
        
        # delay(close, 5)
        delayed_close = self.operators.delay(close, 5)
        
        # sum(delay(close, 5), 20) / 20
        mean_delayed_close = self.operators.ts_mean(delayed_close, 20)
        
        # rank(...)
        rank_mean_delayed = self.cross_ops.rank(mean_delayed_close)
        
        # correlation(close, volume, 2)
        corr_close_vol = self.operators.ts_corr(close, volume, 2)
        
        # sum(close, 5)
        sum_close_5 = self.operators.ts_sum(close, 5)
        
        # sum(close, 20)
        sum_close_20 = self.operators.ts_sum(close, 20)
        
        # correlation(sum(close, 5), sum(close, 20), 2)
        corr_sums = self.operators.ts_corr(sum_close_5, sum_close_20, 2)
        
        # rank(correlation(...))
        rank_corr_sums = self.cross_ops.rank(corr_sums)
        
        result = -1.0 * (rank_mean_delayed * corr_close_vol * rank_corr_sums)
        
        return result
    
    def _compute_alpha046(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#046: ((0.25 < (((delay(close, 20) - delay(close, 10)) / 10) - ((delay(close, 10) - close) / 10))) ? (-1) : (((((delay(close, 20) - delay(close, 10)) / 10) - ((delay(close, 10) - close) / 10)) < 0) ? 1 : ((-1 * (close - delay(close, 1))))))
        """
        close = data['close']
        
        # delay(close, 20), delay(close, 10), delay(close, 1)
        delayed_close_20 = self.operators.delay(close, 20)
        delayed_close_10 = self.operators.delay(close, 10)
        delayed_close_1 = self.operators.delay(close, 1)
        
        # (delay(close, 20) - delay(close, 10)) / 10
        trend_20_10 = (delayed_close_20 - delayed_close_10) / 10.0
        
        # (delay(close, 10) - close) / 10
        trend_10_0 = (delayed_close_10 - close) / 10.0
        
        # 趋势变化
        trend_change = trend_20_10 - trend_10_0
        
        # close - delay(close, 1)
        daily_change = close - delayed_close_1
        
        # 条件表达式
        condition1 = trend_change > 0.25
        condition2 = trend_change < 0
        
        result = np.where(condition1, -1.0,
                         np.where(condition2, 1.0, -1.0 * daily_change))
        
        return result
    
    def _compute_alpha047(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#047: ((((rank((1 / close)) * volume) / adv20) * ((high * rank((high - close))) / (sum(high, 5) / 5)))
        """
        close = data['close']
        volume = data['volume']
        adv20 = data['adv20']
        high = data['high']
        
        # 1 / close
        inv_close = 1.0 / np.maximum(close, 1e-8)
        
        # rank(1 / close)
        rank_inv_close = self.cross_ops.rank(inv_close)
        
        # rank(...) * volume
        rank_vol_product = rank_inv_close * volume
        
        # (...) / adv20
        first_term = rank_vol_product / np.maximum(adv20, 1e-8)
        
        # high - close
        high_close_diff = high - close
        
        # rank(high - close)
        rank_high_close_diff = self.cross_ops.rank(high_close_diff)
        
        # high * rank(...)
        high_rank_product = high * rank_high_close_diff
        
        # sum(high, 5) / 5
        mean_high_5 = self.operators.ts_mean(high, 5)
        
        # (...) / (sum(high, 5) / 5)
        second_term = high_rank_product / np.maximum(mean_high_5, 1e-8)
        
        result = first_term * second_term
        
        return result
    
    def _compute_alpha048(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#048: (indneutralize(((correlation(delta(close, 1), delta(delay(close, 1), 1), 250) * delta(close, 1)) / close), IndClass.subindustry) / sum(((delta(close, 1) / delay(close, 1))^2), 250))
        """
        close = data['close']
        
        # 获取数据长度，如果不足250天，使用可用的最大长度
        n_days = close.shape[1]
        window = min(250, max(20, n_days - 10))
        
        # delta(close, 1)
        delta_close = self.operators.delta(close, 1)
        
        # delay(close, 1)
        delayed_close = self.operators.delay(close, 1)
        
        # delta(delay(close, 1), 1)
        delta_delayed_close = self.operators.delta(delayed_close, 1)
        
        # correlation(delta(close, 1), delta(delay(close, 1), 1), window)
        corr = self.operators.ts_corr(delta_close, delta_delayed_close, window)
        
        # correlation(...) * delta(close, 1)
        corr_delta_product = corr * delta_close
        
        # (...) / close
        normalized_factor = corr_delta_product / np.maximum(close, 1e-8)
        
        # 简化版本：不进行行业中性化，直接使用标准化
        neutralized_factor = self.cross_ops.scale(normalized_factor)
        
        # delta(close, 1) / delay(close, 1)
        returns = delta_close / np.maximum(delayed_close, 1e-8)
        
        # (delta(close, 1) / delay(close, 1))^2
        returns_squared = returns ** 2
        
        # sum(..., window)
        sum_returns_squared = self.operators.ts_sum(returns_squared, window)
        
        # 最终结果
        result = neutralized_factor / np.maximum(sum_returns_squared, 1e-8)
        
        return result
    
    def _compute_alpha049(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#049: (((((delay(close, 20) - delay(close, 10)) / 10) - ((delay(close, 10) - close) / 10)) < (-1 * 0.1)) ? 1 : ((-1 * (close - delay(close, 1)))))
        """
        close = data['close']
        
        # delay(close, 20), delay(close, 10), delay(close, 1)
        delayed_close_20 = self.operators.delay(close, 20)
        delayed_close_10 = self.operators.delay(close, 10)
        delayed_close_1 = self.operators.delay(close, 1)
        
        # (delay(close, 20) - delay(close, 10)) / 10
        trend_20_10 = (delayed_close_20 - delayed_close_10) / 10.0
        
        # (delay(close, 10) - close) / 10
        trend_10_0 = (delayed_close_10 - close) / 10.0
        
        # 趋势加速度
        trend_acceleration = trend_20_10 - trend_10_0
        
        # close - delay(close, 1)
        daily_change = close - delayed_close_1
        
        # 条件表达式
        condition = trend_acceleration < -0.1
        result = np.where(condition, 1.0, -1.0 * daily_change)
        
        return result
    
    def _compute_alpha050(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#050: (-1 * ts_max(rank(correlation(rank(volume), rank(vwap), 5)), 5))
        """
        volume = data['volume']
        vwap = data['vwap']
        
        # rank(volume)
        rank_volume = self.cross_ops.rank(volume)
        
        # rank(vwap)
        rank_vwap = self.cross_ops.rank(vwap)
        
        # correlation(rank(volume), rank(vwap), 5)
        corr = self.operators.ts_corr(rank_volume, rank_vwap, 5)
        
        # rank(correlation(...))
        rank_corr = self.cross_ops.rank(corr)
        
        # ts_max(..., 5)
        ts_max_rank_corr = self.operators.ts_max(rank_corr, 5)
        
        result = -1.0 * ts_max_rank_corr
        
        return result
    
    def _compute_alpha051(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#051: (((delay(close, 20) - delay(close, 10)) / 10) - ((delay(close, 10) - close) / 10))
        """
        close = data['close']
        
        # delay(close, 20), delay(close, 10)
        delayed_close_20 = self.operators.delay(close, 20)
        delayed_close_10 = self.operators.delay(close, 10)
        
        # (delay(close, 20) - delay(close, 10)) / 10
        trend_20_10 = (delayed_close_20 - delayed_close_10) / 10.0
        
        # (delay(close, 10) - close) / 10
        trend_10_0 = (delayed_close_10 - close) / 10.0
        
        # 趋势变化
        result = trend_20_10 - trend_10_0
        
        return result
    
    def _compute_alpha052(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#052: ((((-1 * ts_min(low, 5)) + delay(ts_min(low, 5), 5)) * rank(((sum(returns, 240) - sum(returns, 20)) / 220))) * ts_rank(volume, 5))
        """
        low = data['low']
        returns = data['returns']
        volume = data['volume']
        
        # 获取数据长度，调整窗口
        n_days = low.shape[1]
        sum_window_240 = min(240, max(30, n_days - 10))
        sum_window_20 = min(20, max(10, n_days - 5))
        
        # ts_min(low, 5)
        ts_min_low = self.operators.ts_min(low, 5)
        
        # delay(ts_min(low, 5), 5)
        delayed_ts_min_low = self.operators.delay(ts_min_low, 5)
        
        # (-1 * ts_min(low, 5)) + delay(ts_min(low, 5), 5)
        low_term = (-1.0 * ts_min_low) + delayed_ts_min_low
        
        # sum(returns, 240) - sum(returns, 20)
        sum_returns_240 = self.operators.ts_sum(returns, sum_window_240)
        sum_returns_20 = self.operators.ts_sum(returns, sum_window_20)
        returns_diff = sum_returns_240 - sum_returns_20
        
        # (...) / 220 - 调整分母
        returns_ratio = returns_diff / (sum_window_240 - sum_window_20)
        
        # rank(...)
        rank_returns_ratio = self.cross_ops.rank(returns_ratio)
        
        # ts_rank(volume, 5)
        ts_rank_volume = self.operators.ts_rank(volume, 5)
        
        result = low_term * rank_returns_ratio * ts_rank_volume
        
        return result
    
    def _compute_alpha053(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#053: (-1 * delta(((close - low) / (high - low)), 9))
        """
        close = data['close']
        high = data['high']
        low = data['low']
        
        # (close - low) / (high - low)
        price_position = (close - low) / np.maximum(high - low, 1e-8)
        
        # delta(..., 9)
        delta_price_position = self.operators.delta(price_position, 9)
        
        result = -1.0 * delta_price_position
        
        return result
    
    def _compute_alpha054(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#054: ((-1 * ((low - close) * (open^5))) / ((low - high) * (close^5)))
        """
        low = data['low']
        close = data['close']
        open_price = data['open']
        high = data['high']
        
        # (low - close) * (open^5)
        numerator = (low - close) * np.power(open_price, 5)
        
        # (low - high) * (close^5)
        denominator = (low - high) * np.power(close, 5)
        
        # 避免除零
        result = -1.0 * numerator / np.maximum(np.abs(denominator), 1e-8)
        
        return result
    
    def _compute_alpha055(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#055: (-1 * correlation(rank(((close - ts_min(low, 12)) / (ts_max(high, 12) - ts_min(low, 12)))), rank(volume), 6))
        """
        close = data['close']
        high = data['high']
        low = data['low']
        volume = data['volume']
        
        # ts_min(low, 12)
        ts_min_low = self.operators.ts_min(low, 12)
        
        # ts_max(high, 12)
        ts_max_high = self.operators.ts_max(high, 12)
        
        # (close - ts_min(low, 12)) / (ts_max(high, 12) - ts_min(low, 12))
        price_range = ts_max_high - ts_min_low
        normalized_price = (close - ts_min_low) / np.maximum(price_range, 1e-8)
        
        # rank(...)
        rank_normalized_price = self.cross_ops.rank(normalized_price)
        rank_volume = self.cross_ops.rank(volume)
        
        # correlation(..., 6)
        corr = self.operators.ts_corr(rank_normalized_price, rank_volume, 6)
        
        result = -1.0 * corr
        
        return result
    
    def _compute_alpha056(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#056: (0 - (1 * (rank((sum(returns, 10) / sum(sum(returns, 2), 3))) * rank((returns * cap)))))
        """
        returns = data['returns']
        # 使用volume作为cap的代理
        cap = data['volume']  # 在实际应用中应该是市值
        
        # sum(returns, 10)
        sum_returns_10 = self.operators.ts_sum(returns, 10)
        
        # sum(returns, 2)
        sum_returns_2 = self.operators.ts_sum(returns, 2)
        
        # sum(sum(returns, 2), 3)
        sum_sum_returns = self.operators.ts_sum(sum_returns_2, 3)
        
        # sum(returns, 10) / sum(sum(returns, 2), 3)
        returns_ratio = sum_returns_10 / np.maximum(sum_sum_returns, 1e-8)
        
        # rank(...)
        rank_returns_ratio = self.cross_ops.rank(returns_ratio)
        
        # returns * cap
        returns_cap = returns * cap
        
        # rank(returns * cap)
        rank_returns_cap = self.cross_ops.rank(returns_cap)
        
        result = -1.0 * rank_returns_ratio * rank_returns_cap
        
        return result
    
    def _compute_alpha057(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#057: (0 - (1 * ((close - vwap) / decay_linear(rank(ts_argmax(close, 30)), 2))))
        """
        close = data['close']
        vwap = data['vwap']
        
        # ts_argmax(close, 30)
        ts_argmax_close = self.operators.ts_argmax(close, 30)
        
        # rank(ts_argmax(close, 30))
        rank_ts_argmax = self.cross_ops.rank(ts_argmax_close)
        
        # decay_linear(..., 2) - 使用简化版本
        decay_result = self.operators.ts_mean(rank_ts_argmax, 2)
        
        # (close - vwap) / decay_linear(...)
        result = -1.0 * (close - vwap) / np.maximum(decay_result, 1e-8)
        
        return result
    
    def _compute_alpha058(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#058: (-1 * ts_rank(decay_linear(correlation(IndNeutralize(vwap, IndClass.sector), volume, 3.92593), 7.89391), 5.50322))
        """
        vwap = data['vwap']
        volume = data['volume']
        
        # 简化版本：不进行行业中性化，直接使用标准化
        neutralized_vwap = self.cross_ops.scale(vwap)
        
        # correlation(..., 4) - 四舍五入3.92593
        corr = self.operators.ts_corr(neutralized_vwap, volume, 4)
        
        # decay_linear(..., 8) - 四舍五入7.89391
        decay_result = self.operators.ts_mean(corr, 8)
        
        # ts_rank(..., 6) - 四舍五入5.50322
        ts_rank_result = self.operators.ts_rank(decay_result, 6)
        
        result = -1.0 * ts_rank_result
        
        return result
    
    def _compute_alpha059(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#059: (-1 * ts_rank(decay_linear(correlation(IndNeutralize(((vwap * 0.728317) + (vwap * (1 - 0.728317))), IndClass.industry), volume, 4.25197), 16.2289), 8.19648))
        """
        vwap = data['vwap']
        volume = data['volume']
        
        # (vwap * 0.728317) + (vwap * (1 - 0.728317)) = vwap
        # 这个公式实际上就是vwap本身
        adjusted_vwap = vwap
        
        # 简化版本：不进行行业中性化，直接使用标准化
        neutralized_vwap = self.cross_ops.scale(adjusted_vwap)
        
        # correlation(..., 4) - 四舍五入4.25197
        corr = self.operators.ts_corr(neutralized_vwap, volume, 4)
        
        # decay_linear(..., 16) - 四舍五入16.2289
        decay_result = self.operators.ts_mean(corr, 16)
        
        # ts_rank(..., 8) - 四舍五入8.19648
        ts_rank_result = self.operators.ts_rank(decay_result, 8)
        
        result = -1.0 * ts_rank_result
        
        return result
    
    def _compute_alpha060(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#060: (0 - (1 * ((2 * scale(rank(((((close - low) - (high - close)) / (high - low)) * volume)))) - scale(rank(ts_argmax(close, 10))))))
        """
        close = data['close']
        high = data['high']
        low = data['low']
        volume = data['volume']
        
        # ((close - low) - (high - close)) / (high - low)
        price_momentum = ((close - low) - (high - close)) / np.maximum(high - low, 1e-8)
        
        # (...) * volume
        volume_weighted = price_momentum * volume
        
        # rank(...)
        rank_volume_weighted = self.cross_ops.rank(volume_weighted)
        
        # scale(rank(...))
        scale_rank_volume = self.cross_ops.scale(rank_volume_weighted)
        
        # ts_argmax(close, 10)
        ts_argmax_close = self.operators.ts_argmax(close, 10)
        
        # rank(ts_argmax(close, 10))
        rank_ts_argmax = self.cross_ops.rank(ts_argmax_close)
        
        # scale(rank(...))
        scale_rank_argmax = self.cross_ops.scale(rank_ts_argmax)
        
        result = -1.0 * (2.0 * scale_rank_volume - scale_rank_argmax)
        
        return result
    
    def _compute_alpha061(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#061: (rank((vwap - ts_min(vwap, 16.1219))) < rank(correlation(vwap, adv180, 17.9282)))
        """
        vwap = data['vwap']
        # 使用adv20作为adv180的代理
        adv180 = data['adv20']
        
        # ts_min(vwap, 16) - 四舍五入16.1219
        ts_min_vwap = self.operators.ts_min(vwap, 16)
        
        # vwap - ts_min(vwap, 16)
        vwap_diff = vwap - ts_min_vwap
        
        # rank(...)
        rank_vwap_diff = self.cross_ops.rank(vwap_diff)
        
        # correlation(vwap, adv180, 18) - 四舍五入17.9282
        corr = self.operators.ts_corr(vwap, adv180, 18)
        
        # rank(correlation(...))
        rank_corr = self.cross_ops.rank(corr)
        
        # 比较运算，转换为数值
        result = (rank_vwap_diff < rank_corr).astype(np.float64)
        
        return result
    
    def _compute_alpha062(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#062: ((rank(correlation(vwap, sum(adv20, 22.4101), 9.91009)) < rank(((rank(open) + rank(open)) < (rank(((high + low) / 2)) + rank(high))))) * -1)
        """
        vwap = data['vwap']
        adv20 = data['adv20']
        open_price = data['open']
        high = data['high']
        low = data['low']
        
        # sum(adv20, 22) - 四舍五入22.4101
        sum_adv20 = self.operators.ts_sum(adv20, 22)
        
        # correlation(vwap, sum(adv20, 22), 10) - 四舍五入9.91009
        corr = self.operators.ts_corr(vwap, sum_adv20, 10)
        
        # rank(correlation(...))
        rank_corr = self.cross_ops.rank(corr)
        
        # rank(open) + rank(open) = 2 * rank(open)
        rank_open = self.cross_ops.rank(open_price)
        double_rank_open = 2.0 * rank_open
        
        # (high + low) / 2
        mid_price = (high + low) / 2.0
        
        # rank(((high + low) / 2)) + rank(high)
        rank_mid = self.cross_ops.rank(mid_price)
        rank_high = self.cross_ops.rank(high)
        rank_sum = rank_mid + rank_high
        
        # 比较运算
        condition1 = rank_corr < (double_rank_open < rank_sum).astype(np.float64)
        
        result = condition1.astype(np.float64) * -1.0
        
        return result
    
    def _compute_alpha063(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#063: ((rank(decay_linear(delta(IndNeutralize(close, IndClass.industry), 2.25164), 8.22237)) - rank(decay_linear(correlation(((vwap * 0.318108) + (open * (1 - 0.318108))), sum(adv180, 37.2467), 13.557), 12.2883))) * -1)
        """
        close = data['close']
        vwap = data['vwap']
        open_price = data['open']
        # 使用adv20作为adv180的代理
        adv180 = data['adv20']
        
        # 简化版本：不进行行业中性化，直接使用标准化
        neutralized_close = self.cross_ops.scale(close)
        
        # delta(..., 2) - 四舍五入2.25164
        delta_close = self.operators.delta(neutralized_close, 2)
        
        # decay_linear(..., 8) - 四舍五入8.22237
        decay1 = self.operators.ts_mean(delta_close, 8)
        
        # rank(...)
        rank1 = self.cross_ops.rank(decay1)
        
        # (vwap * 0.318108) + (open * (1 - 0.318108))
        weighted_price = vwap * 0.318108 + open_price * (1 - 0.318108)
        
        # sum(adv180, 37) - 四舍五入37.2467
        sum_adv180 = self.operators.ts_sum(adv180, 37)
        
        # correlation(..., 14) - 四舍五入13.557
        corr = self.operators.ts_corr(weighted_price, sum_adv180, 14)
        
        # decay_linear(..., 12) - 四舍五入12.2883
        decay2 = self.operators.ts_mean(corr, 12)
        
        # rank(...)
        rank2 = self.cross_ops.rank(decay2)
        
        result = (rank1 - rank2) * -1.0
        
        return result
    
    def _compute_alpha064(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#064: ((rank(correlation(sum(((open * 0.178404) + (low * (1 - 0.178404))), 12.7054), sum(adv120, 12.7054), 16.6208)) < rank(delta(((((high + low) / 2) * 0.178404) + (vwap * (1 - 0.178404))), 3.69741))) * -1)
        """
        open_price = data['open']
        low = data['low']
        high = data['high']
        vwap = data['vwap']
        # 使用adv20作为adv120的代理
        adv120 = data['adv20']
        
        # (open * 0.178404) + (low * (1 - 0.178404))
        weighted_price1 = open_price * 0.178404 + low * (1 - 0.178404)
        
        # sum(..., 13) - 四舍五入12.7054
        sum_weighted1 = self.operators.ts_sum(weighted_price1, 13)
        
        # sum(adv120, 13)
        sum_adv120 = self.operators.ts_sum(adv120, 13)
        
        # correlation(..., 17) - 四舍五入16.6208
        corr = self.operators.ts_corr(sum_weighted1, sum_adv120, 17)
        
        # rank(correlation(...))
        rank_corr = self.cross_ops.rank(corr)
        
        # ((high + low) / 2) * 0.178404) + (vwap * (1 - 0.178404))
        mid_price = (high + low) / 2.0
        weighted_price2 = mid_price * 0.178404 + vwap * (1 - 0.178404)
        
        # delta(..., 4) - 四舍五入3.69741
        delta_weighted = self.operators.delta(weighted_price2, 4)
        
        # rank(delta(...))
        rank_delta = self.cross_ops.rank(delta_weighted)
        
        # 比较运算
        condition = rank_corr < rank_delta
        
        result = condition.astype(np.float64) * -1.0
        
        return result
    
    def _compute_alpha065(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#065: ((rank(correlation(((open * 0.00817205) + (vwap * (1 - 0.00817205))), sum(adv60, 8.6911), 6.40374)) < rank((open - ts_min(open, 13.635)))) * -1)
        """
        open_price = data['open']
        vwap = data['vwap']
        # 使用adv20作为adv60的代理
        adv60 = data['adv20']
        
        # (open * 0.00817205) + (vwap * (1 - 0.00817205))
        weighted_price = open_price * 0.00817205 + vwap * (1 - 0.00817205)
        
        # sum(adv60, 9) - 四舍五入8.6911
        sum_adv60 = self.operators.ts_sum(adv60, 9)
        
        # correlation(..., 6) - 四舍五入6.40374
        corr = self.operators.ts_corr(weighted_price, sum_adv60, 6)
        
        # rank(correlation(...))
        rank_corr = self.cross_ops.rank(corr)
        
        # ts_min(open, 14) - 四舍五入13.635
        ts_min_open = self.operators.ts_min(open_price, 14)
        
        # open - ts_min(open, 14)
        open_diff = open_price - ts_min_open
        
        # rank(...)
        rank_open_diff = self.cross_ops.rank(open_diff)
        
        # 比较运算
        condition = rank_corr < rank_open_diff
        
        result = condition.astype(np.float64) * -1.0
        
        return result
    
    def _compute_alpha066(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#066: ((rank(decay_linear(delta(vwap, 3.51013), 7.23052)) + ts_rank(decay_linear(((((low * 0.96633) + (low * (1 - 0.96633))) - vwap) / (open - ((high + low) / 2))), 11.4157), 6.72611)) * -1)
        """
        vwap = data['vwap']
        low = data['low']
        open_price = data['open']
        high = data['high']
        
        # delta(vwap, 4) - 四舍五入3.51013
        delta_vwap = self.operators.delta(vwap, 4)
        
        # decay_linear(..., 7) - 四舍五入7.23052
        decay1 = self.operators.ts_mean(delta_vwap, 7)
        
        # rank(...)
        rank1 = self.cross_ops.rank(decay1)
        
        # (low * 0.96633) + (low * (1 - 0.96633)) = low
        # 这个公式实际上就是low本身
        adjusted_low = low
        
        # (high + low) / 2
        mid_price = (high + low) / 2.0
        
        # (adjusted_low - vwap) / (open - mid_price)
        ratio = (adjusted_low - vwap) / np.maximum(np.abs(open_price - mid_price), 1e-8)
        
        # decay_linear(..., 11) - 四舍五入11.4157
        decay2 = self.operators.ts_mean(ratio, 11)
        
        # ts_rank(..., 7) - 四舍五入6.72611
        ts_rank_result = self.operators.ts_rank(decay2, 7)
        
        result = (rank1 + ts_rank_result) * -1.0
        
        return result
    
    def _compute_alpha067(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#067: ((rank((high - ts_min(high, 2.14593)))^rank(correlation(IndNeutralize(vwap, IndClass.sector), IndNeutralize(adv20, IndClass.sector), 6.02936))) * -1)
        """
        high = data['high']
        vwap = data['vwap']
        adv20 = data['adv20']
        
        # ts_min(high, 2) - 四舍五入2.14593
        ts_min_high = self.operators.ts_min(high, 2)
        
        # high - ts_min(high, 2)
        high_diff = high - ts_min_high
        
        # rank(...)
        rank_high_diff = self.cross_ops.rank(high_diff)
        
        # 简化版本：不进行行业中性化，直接使用标准化
        neutralized_vwap = self.cross_ops.scale(vwap)
        neutralized_adv20 = self.cross_ops.scale(adv20)
        
        # correlation(..., 6) - 四舍五入6.02936
        corr = self.operators.ts_corr(neutralized_vwap, neutralized_adv20, 6)
        
        # rank(correlation(...))
        rank_corr = self.cross_ops.rank(corr)
        
        # rank(...)^rank(...)
        powered = np.power(np.maximum(rank_high_diff, 1e-8), rank_corr)
        
        result = powered * -1.0
        
        return result
    
    def _compute_alpha068(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#068: ((ts_rank(correlation(rank(high), rank(adv15), 8.91644), 13.9333) < rank(delta(((close * 0.518371) + (low * (1 - 0.518371))), 1.06157))) * -1)
        """
        high = data['high']
        close = data['close']
        low = data['low']
        # 使用adv20作为adv15的代理
        adv15 = data['adv20']
        
        # rank(high)
        rank_high = self.cross_ops.rank(high)
        
        # rank(adv15)
        rank_adv15 = self.cross_ops.rank(adv15)
        
        # correlation(..., 9) - 四舍五入8.91644
        corr = self.operators.ts_corr(rank_high, rank_adv15, 9)
        
        # ts_rank(..., 14) - 四舍五入13.9333
        ts_rank_corr = self.operators.ts_rank(corr, 14)
        
        # (close * 0.518371) + (low * (1 - 0.518371))
        weighted_price = close * 0.518371 + low * (1 - 0.518371)
        
        # delta(..., 1) - 四舍五入1.06157
        delta_weighted = self.operators.delta(weighted_price, 1)
        
        # rank(delta(...))
        rank_delta = self.cross_ops.rank(delta_weighted)
        
        # 比较运算
        condition = ts_rank_corr < rank_delta
        
        result = condition.astype(np.float64) * -1.0
        
        return result
    
    def _compute_alpha069(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#069: ((rank(ts_max(delta(IndNeutralize(vwap, IndClass.industry), 2.72412), 4.79344))^ts_rank(correlation(((close * 0.490655) + (vwap * (1 - 0.490655))), adv20, 4.92416), 9.0615)) * -1)
        """
        vwap = data['vwap']
        close = data['close']
        adv20 = data['adv20']
        
        # 简化版本：不进行行业中性化，直接使用标准化
        neutralized_vwap = self.cross_ops.scale(vwap)
        
        # delta(..., 3) - 四舍五入2.72412
        delta_vwap = self.operators.delta(neutralized_vwap, 3)
        
        # ts_max(..., 5) - 四舍五入4.79344
        ts_max_delta = self.operators.ts_max(delta_vwap, 5)
        
        # rank(...)
        rank_ts_max = self.cross_ops.rank(ts_max_delta)
        
        # (close * 0.490655) + (vwap * (1 - 0.490655))
        weighted_price = close * 0.490655 + vwap * (1 - 0.490655)
        
        # correlation(..., 5) - 四舍五入4.92416
        corr = self.operators.ts_corr(weighted_price, adv20, 5)
        
        # ts_rank(..., 9) - 四舍五入9.0615
        ts_rank_corr = self.operators.ts_rank(corr, 9)
        
        # rank(...)^ts_rank(...)
        powered = np.power(np.maximum(rank_ts_max, 1e-8), ts_rank_corr)
        
        result = powered * -1.0
        
        return result
    
    def _compute_alpha070(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#070: ((rank(delta(vwap, 1.29456))^ts_rank(correlation(IndNeutralize(close, IndClass.industry), adv50, 17.8256), 17.9171)) * -1)
        """
        vwap = data['vwap']
        close = data['close']
        # 使用adv20作为adv50的代理
        adv50 = data['adv20']
        
        # delta(vwap, 1) - 四舍五入1.29456
        delta_vwap = self.operators.delta(vwap, 1)
        
        # rank(...)
        rank_delta = self.cross_ops.rank(delta_vwap)
        
        # 简化版本：不进行行业中性化，直接使用标准化
        neutralized_close = self.cross_ops.scale(close)
        
        # correlation(..., 18) - 四舍五入17.8256
        corr = self.operators.ts_corr(neutralized_close, adv50, 18)
        
        # ts_rank(..., 18) - 四舍五入17.9171
        ts_rank_corr = self.operators.ts_rank(corr, 18)
        
        # rank(...)^ts_rank(...)
        powered = np.power(np.maximum(rank_delta, 1e-8), ts_rank_corr)
        
        result = powered * -1.0
        
        return result
    
    def _compute_alpha071(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#071: max(ts_rank(decay_linear(correlation(ts_rank(close, 3.43976), ts_rank(adv180, 12.0647), 18.0175), 4.20501), 15.6948), ts_rank(decay_linear((rank(((low + open) - (vwap + vwap)))^2), 16.4662), 4.4388))
        """
        close = data['close']
        low = data['low']
        open_price = data['open']
        vwap = data['vwap']
        # 使用adv20作为adv180的代理
        adv180 = data['adv20']
        
        # ts_rank(close, 3) - 四舍五入3.43976
        ts_rank_close = self.operators.ts_rank(close, 3)
        
        # ts_rank(adv180, 12) - 四舍五入12.0647
        ts_rank_adv180 = self.operators.ts_rank(adv180, 12)
        
        # correlation(..., 18) - 四舍五入18.0175
        corr = self.operators.ts_corr(ts_rank_close, ts_rank_adv180, 18)
        
        # decay_linear(..., 4) - 四舍五入4.20501
        decay1 = self.operators.ts_mean(corr, 4)
        
        # ts_rank(..., 16) - 四舍五入15.6948
        ts_rank1 = self.operators.ts_rank(decay1, 16)
        
        # (low + open) - (vwap + vwap)
        price_diff = (low + open_price) - (vwap + vwap)
        
        # rank(...)
        rank_price_diff = self.cross_ops.rank(price_diff)
        
        # rank(...)^2
        rank_squared = np.power(rank_price_diff, 2)
        
        # decay_linear(..., 16) - 四舍五入16.4662
        decay2 = self.operators.ts_mean(rank_squared, 16)
        
        # ts_rank(..., 4) - 四舍五入4.4388
        ts_rank2 = self.operators.ts_rank(decay2, 4)
        
        # max(...)
        result = np.maximum(ts_rank1, ts_rank2)
        
        return result
    
    def _compute_alpha072(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#072: (rank(decay_linear(correlation(((high + low) / 2), adv40, 8.93345), 10.1519)) / rank(decay_linear(correlation(ts_rank(vwap, 3.72469), ts_rank(volume, 18.5188), 6.86671), 2.95011)))
        """
        high = data['high']
        low = data['low']
        vwap = data['vwap']
        volume = data['volume']
        # 使用adv20作为adv40的代理
        adv40 = data['adv20']
        
        # (high + low) / 2
        mid_price = (high + low) / 2.0
        
        # correlation(..., 9) - 四舍五入8.93345
        corr1 = self.operators.ts_corr(mid_price, adv40, 9)
        
        # decay_linear(..., 10) - 四舍五入10.1519
        decay1 = self.operators.ts_mean(corr1, 10)
        
        # rank(...)
        rank1 = self.cross_ops.rank(decay1)
        
        # ts_rank(vwap, 4) - 四舍五入3.72469
        ts_rank_vwap = self.operators.ts_rank(vwap, 4)
        
        # ts_rank(volume, 19) - 四舍五入18.5188
        ts_rank_volume = self.operators.ts_rank(volume, 19)
        
        # correlation(..., 7) - 四舍五入6.86671
        corr2 = self.operators.ts_corr(ts_rank_vwap, ts_rank_volume, 7)
        
        # decay_linear(..., 3) - 四舍五入2.95011
        decay2 = self.operators.ts_mean(corr2, 3)
        
        # rank(...)
        rank2 = self.cross_ops.rank(decay2)
        
        # rank(...) / rank(...)
        result = rank1 / np.maximum(rank2, 1e-8)
        
        return result
    
    def _compute_alpha073(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#073: (max(rank(decay_linear(delta(vwap, 4.72775), 2.91864)), ts_rank(decay_linear(((delta(((open * 0.147155) + (low * (1 - 0.147155))), 2.03608) / ((open * 0.147155) + (low * (1 - 0.147155)))) * -1), 3.33829), 16.7411)) * -1)
        """
        vwap = data['vwap']
        open_price = data['open']
        low = data['low']
        
        # delta(vwap, 5) - 四舍五入4.72775
        delta_vwap = self.operators.delta(vwap, 5)
        
        # decay_linear(..., 3) - 四舍五入2.91864
        decay1 = self.operators.ts_mean(delta_vwap, 3)
        
        # rank(...)
        rank1 = self.cross_ops.rank(decay1)
        
        # (open * 0.147155) + (low * (1 - 0.147155))
        weighted_price = open_price * 0.147155 + low * (1 - 0.147155)
        
        # delta(..., 2) - 四舍五入2.03608
        delta_weighted = self.operators.delta(weighted_price, 2)
        
        # delta(...) / weighted_price
        ratio = delta_weighted / np.maximum(weighted_price, 1e-8)
        
        # (...) * -1
        neg_ratio = ratio * -1.0
        
        # decay_linear(..., 3) - 四舍五入3.33829
        decay2 = self.operators.ts_mean(neg_ratio, 3)
        
        # ts_rank(..., 17) - 四舍五入16.7411
        ts_rank2 = self.operators.ts_rank(decay2, 17)
        
        # max(...)
        max_result = np.maximum(rank1, ts_rank2)
        
        result = max_result * -1.0
        
        return result
    
    def _compute_alpha074(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#074: ((rank(correlation(close, sum(adv30, 37.4843), 15.1365)) < rank(correlation(rank(((high * 0.0261661) + (vwap * (1 - 0.0261661)))), rank(volume), 11.4791))) * -1)
        """
        close = data['close']
        high = data['high']
        vwap = data['vwap']
        volume = data['volume']
        # 使用adv20作为adv30的代理
        adv30 = data['adv20']
        
        # sum(adv30, 37) - 四舍五入37.4843
        sum_adv30 = self.operators.ts_sum(adv30, 37)
        
        # correlation(close, sum(adv30, 37), 15) - 四舍五入15.1365
        corr1 = self.operators.ts_corr(close, sum_adv30, 15)
        
        # rank(...)
        rank1 = self.cross_ops.rank(corr1)
        
        # (high * 0.0261661) + (vwap * (1 - 0.0261661))
        weighted_price = high * 0.0261661 + vwap * (1 - 0.0261661)
        
        # rank(...)
        rank_weighted = self.cross_ops.rank(weighted_price)
        rank_volume = self.cross_ops.rank(volume)
        
        # correlation(..., 11) - 四舍五入11.4791
        corr2 = self.operators.ts_corr(rank_weighted, rank_volume, 11)
        
        # rank(...)
        rank2 = self.cross_ops.rank(corr2)
        
        # 比较运算
        condition = rank1 < rank2
        
        result = condition.astype(np.float64) * -1.0
        
        return result
    
    def _compute_alpha075(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#075: (rank(correlation(vwap, volume, 4.24304)) < rank(correlation(rank(low), rank(adv50), 12.4413)))
        """
        vwap = data['vwap']
        volume = data['volume']
        low = data['low']
        # 使用adv20作为adv50的代理
        adv50 = data['adv20']
        
        # correlation(vwap, volume, 4) - 四舍五入4.24304
        corr1 = self.operators.ts_corr(vwap, volume, 4)
        
        # rank(...)
        rank1 = self.cross_ops.rank(corr1)
        
        # rank(low)
        rank_low = self.cross_ops.rank(low)
        
        # rank(adv50)
        rank_adv50 = self.cross_ops.rank(adv50)
        
        # correlation(..., 12) - 四舍五入12.4413
        corr2 = self.operators.ts_corr(rank_low, rank_adv50, 12)
        
        # rank(...)
        rank2 = self.cross_ops.rank(corr2)
        
        # 比较运算
        result = (rank1 < rank2).astype(np.float64)
        
        return result
    
    def _compute_alpha076(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#076: (max(rank(decay_linear(delta(vwap, 1.24383), 11.8259)), ts_rank(decay_linear(ts_rank(correlation(IndNeutralize(low, IndClass.sector), adv81, 8.14941), 19.569), 17.1543), 19.383)) * -1)
        """
        vwap = data['vwap']
        low = data['low']
        # 使用adv20作为adv81的代理
        adv81 = data['adv20']
        
        # delta(vwap, 1) - 四舍五入1.24383
        delta_vwap = self.operators.delta(vwap, 1)
        
        # decay_linear(..., 12) - 四舍五入11.8259
        decay1 = self.operators.ts_mean(delta_vwap, 12)
        
        # rank(...)
        rank1 = self.cross_ops.rank(decay1)
        
        # 简化版本：不进行行业中性化，直接使用标准化
        neutralized_low = self.cross_ops.scale(low)
        
        # correlation(..., 8) - 四舍五入8.14941
        corr = self.operators.ts_corr(neutralized_low, adv81, 8)
        
        # ts_rank(..., 20) - 四舍五入19.569
        ts_rank_corr = self.operators.ts_rank(corr, 20)
        
        # decay_linear(..., 17) - 四舍五入17.1543
        decay2 = self.operators.ts_mean(ts_rank_corr, 17)
        
        # ts_rank(..., 19) - 四舍五入19.383
        ts_rank2 = self.operators.ts_rank(decay2, 19)
        
        # max(...)
        max_result = np.maximum(rank1, ts_rank2)
        
        result = max_result * -1.0
        
        return result
    
    def _compute_alpha077(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#077: min(rank(decay_linear(((((high + low) / 2) + high) - (vwap + high)), 20.0451)), rank(decay_linear(correlation(((high + low) / 2), adv40, 3.1614), 5.64125)))
        """
        high = data['high']
        low = data['low']
        vwap = data['vwap']
        # 使用adv20作为adv40的代理
        adv40 = data['adv20']
        
        # (high + low) / 2
        mid_price = (high + low) / 2.0
        
        # ((high + low) / 2) + high - (vwap + high)
        price_diff = mid_price + high - (vwap + high)
        
        # decay_linear(..., 20) - 四舍五入20.0451
        decay1 = self.operators.ts_mean(price_diff, 20)
        
        # rank(...)
        rank1 = self.cross_ops.rank(decay1)
        
        # correlation(..., 3) - 四舍五入3.1614
        corr = self.operators.ts_corr(mid_price, adv40, 3)
        
        # decay_linear(..., 6) - 四舍五入5.64125
        decay2 = self.operators.ts_mean(corr, 6)
        
        # rank(...)
        rank2 = self.cross_ops.rank(decay2)
        
        # min(...)
        result = np.minimum(rank1, rank2)
        
        return result
    
    def _compute_alpha078(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#078: (rank(correlation(sum(((low * 0.352233) + (vwap * (1 - 0.352233))), 19.7428), sum(adv40, 19.7428), 6.83313))^rank(correlation(rank(vwap), rank(volume), 5.77492)))
        """
        low = data['low']
        vwap = data['vwap']
        volume = data['volume']
        # 使用adv20作为adv40的代理
        adv40 = data['adv20']
        
        # (low * 0.352233) + (vwap * (1 - 0.352233))
        weighted_price = low * 0.352233 + vwap * (1 - 0.352233)
        
        # sum(..., 20) - 四舍五入19.7428
        sum_weighted = self.operators.ts_sum(weighted_price, 20)
        
        # sum(adv40, 20)
        sum_adv40 = self.operators.ts_sum(adv40, 20)
        
        # correlation(..., 7) - 四舍五入6.83313
        corr1 = self.operators.ts_corr(sum_weighted, sum_adv40, 7)
        
        # rank(...)
        rank1 = self.cross_ops.rank(corr1)
        
        # rank(vwap), rank(volume)
        rank_vwap = self.cross_ops.rank(vwap)
        rank_volume = self.cross_ops.rank(volume)
        
        # correlation(..., 6) - 四舍五入5.77492
        corr2 = self.operators.ts_corr(rank_vwap, rank_volume, 6)
        
        # rank(...)
        rank2 = self.cross_ops.rank(corr2)
        
        # rank(...)^rank(...)
        result = np.power(np.maximum(rank1, 1e-8), rank2)
        
        return result
    
    def _compute_alpha079(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#079: (rank(delta(IndNeutralize(((close * 0.60733) + (open * (1 - 0.60733))), IndClass.sector), 1.23438)) < rank(correlation(ts_rank(vwap, 3.60973), ts_rank(adv150, 9.18637), 14.6644)))
        """
        close = data['close']
        open_price = data['open']
        vwap = data['vwap']
        # 使用adv20作为adv150的代理
        adv150 = data['adv20']
        
        # (close * 0.60733) + (open * (1 - 0.60733))
        weighted_price = close * 0.60733 + open_price * (1 - 0.60733)
        
        # 简化版本：不进行行业中性化，直接使用标准化
        neutralized_price = self.cross_ops.scale(weighted_price)
        
        # delta(..., 1) - 四舍五入1.23438
        delta_price = self.operators.delta(neutralized_price, 1)
        
        # rank(...)
        rank1 = self.cross_ops.rank(delta_price)
        
        # ts_rank(vwap, 4) - 四舍五入3.60973
        ts_rank_vwap = self.operators.ts_rank(vwap, 4)
        
        # ts_rank(adv150, 9) - 四舍五入9.18637
        ts_rank_adv150 = self.operators.ts_rank(adv150, 9)
        
        # correlation(..., 15) - 四舍五入14.6644
        corr = self.operators.ts_corr(ts_rank_vwap, ts_rank_adv150, 15)
        
        # rank(...)
        rank2 = self.cross_ops.rank(corr)
        
        # 比较运算
        result = (rank1 < rank2).astype(np.float64)
        
        return result
    
    def _compute_alpha080(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#080: ((rank(sign(delta(IndNeutralize(((open * 0.868128) + (high * (1 - 0.868128))), IndClass.industry), 4.04545)))^ts_rank(correlation(high, adv10, 5.11456), 5.53756)) * -1)
        """
        open_price = data['open']
        high = data['high']
        # 使用adv20作为adv10的代理
        adv10 = data['adv20']
        
        # (open * 0.868128) + (high * (1 - 0.868128))
        weighted_price = open_price * 0.868128 + high * (1 - 0.868128)
        
        # 简化版本：不进行行业中性化，直接使用标准化
        neutralized_price = self.cross_ops.scale(weighted_price)
        
        # delta(..., 4) - 四舍五入4.04545
        delta_price = self.operators.delta(neutralized_price, 4)
        
        # sign(...)
        sign_delta = np.sign(delta_price)
        
        # rank(...)
        rank1 = self.cross_ops.rank(sign_delta)
        
        # correlation(high, adv10, 5) - 四舍五入5.11456
        corr = self.operators.ts_corr(high, adv10, 5)
        
        # ts_rank(..., 6) - 四舍五入5.53756
        ts_rank_corr = self.operators.ts_rank(corr, 6)
        
        # rank(...)^ts_rank(...)
        powered = np.power(np.maximum(rank1, 1e-8), ts_rank_corr)
        
        result = powered * -1.0
        
        return result
    
    def _compute_alpha081(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#081: ((rank(log(product(rank((rank(correlation(vwap, sum(adv10, 49.6054), 8.47743))^4)), 14.9655))) < rank(correlation(rank(vwap), rank(adv81), 5.07914))) * -1)
        """
        vwap = data['vwap']
        # 使用adv20作为adv10和adv81的代理
        adv10 = data['adv20']
        adv81 = data['adv20']
        
        # sum(adv10, 50) - 四舍五入49.6054
        sum_adv10 = self.operators.ts_sum(adv10, 50)
        
        # correlation(..., 8) - 四舍五入8.47743
        corr1 = self.operators.ts_corr(vwap, sum_adv10, 8)
        
        # rank(...)
        rank_corr1 = self.cross_ops.rank(corr1)
        
        # rank(...)^4
        powered = np.power(np.maximum(rank_corr1, 1e-8), 4)
        
        # rank(...)
        rank_powered = self.cross_ops.rank(powered)
        
        # product(..., 15) - 简化为ts_mean，四舍五入14.9655
        product_result = self.operators.ts_mean(rank_powered, 15)
        
        # log(...)
        log_result = np.log(np.maximum(product_result, 1e-8))
        
        # rank(...)
        rank1 = self.cross_ops.rank(log_result)
        
        # rank(vwap), rank(adv81)
        rank_vwap = self.cross_ops.rank(vwap)
        rank_adv81 = self.cross_ops.rank(adv81)
        
        # correlation(..., 5) - 四舍五入5.07914
        corr2 = self.operators.ts_corr(rank_vwap, rank_adv81, 5)
        
        # rank(...)
        rank2 = self.cross_ops.rank(corr2)
        
        # 比较运算
        condition = rank1 < rank2
        
        result = condition.astype(np.float64) * -1.0
        
        return result
    
    def _compute_alpha082(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#082: (min(rank(decay_linear(delta(open, 1.46063), 14.8717)), ts_rank(decay_linear(correlation(IndNeutralize(volume, IndClass.sector), ((open * 0.634196) + (open * (1 - 0.634196))), 17.4842), 6.92131), 13.4283)) * -1)
        """
        open_price = data['open']
        volume = data['volume']
        
        # delta(open, 1) - 四舍五入1.46063
        delta_open = self.operators.delta(open_price, 1)
        
        # decay_linear(..., 15) - 四舍五入14.8717
        decay1 = self.operators.ts_mean(delta_open, 15)
        
        # rank(...)
        rank1 = self.cross_ops.rank(decay1)
        
        # 简化版本：不进行行业中性化，直接使用标准化
        neutralized_volume = self.cross_ops.scale(volume)
        
        # (open * 0.634196) + (open * (1 - 0.634196)) = open
        # 这个公式实际上就是open本身
        weighted_open = open_price
        
        # correlation(..., 17) - 四舍五入17.4842
        corr = self.operators.ts_corr(neutralized_volume, weighted_open, 17)
        
        # decay_linear(..., 7) - 四舍五入6.92131
        decay2 = self.operators.ts_mean(corr, 7)
        
        # ts_rank(..., 13) - 四舍五入13.4283
        ts_rank_result = self.operators.ts_rank(decay2, 13)
        
        # min(...)
        min_result = np.minimum(rank1, ts_rank_result)
        
        result = min_result * -1.0
        
        return result
    
    def _compute_alpha083(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#083: ((rank(delay(((high - low) / (sum(close, 5) / 5)), 2)) * rank(rank(volume))) / (((high - low) / (sum(close, 5) / 5)) / (vwap - close)))
        """
        high = data['high']
        low = data['low']
        close = data['close']
        volume = data['volume']
        vwap = data['vwap']
        
        # sum(close, 5) / 5
        mean_close_5 = self.operators.ts_mean(close, 5)
        
        # (high - low) / (sum(close, 5) / 5)
        price_range_ratio = (high - low) / np.maximum(mean_close_5, 1e-8)
        
        # delay(..., 2)
        delayed_ratio = self.operators.delay(price_range_ratio, 2)
        
        # rank(...)
        rank_delayed = self.cross_ops.rank(delayed_ratio)
        
        # rank(rank(volume))
        rank_rank_volume = self.cross_ops.rank(self.cross_ops.rank(volume))
        
        # 分子
        numerator = rank_delayed * rank_rank_volume
        
        # vwap - close
        vwap_close_diff = vwap - close
        
        # (...) / (vwap - close)
        denominator = price_range_ratio / np.maximum(np.abs(vwap_close_diff), 1e-8)
        
        result = numerator / np.maximum(np.abs(denominator), 1e-8)
        
        return result
    
    def _compute_alpha084(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#084: SignedPower(ts_rank((vwap - ts_max(vwap, 15.3217)), 20.7127), delta(close, 4.96796))
        """
        vwap = data['vwap']
        close = data['close']
        
        # ts_max(vwap, 15) - 四舍五入15.3217
        ts_max_vwap = self.operators.ts_max(vwap, 15)
        
        # vwap - ts_max(vwap, 15)
        vwap_diff = vwap - ts_max_vwap
        
        # ts_rank(..., 21) - 四舍五入20.7127
        ts_rank_diff = self.operators.ts_rank(vwap_diff, 21)
        
        # delta(close, 5) - 四舍五入4.96796
        delta_close = self.operators.delta(close, 5)
        
        # SignedPower - 使用符号保持的幂运算
        # 如果底数为负，结果也为负
        base = ts_rank_diff
        exponent = delta_close
        
        # 处理符号
        sign_base = np.sign(base)
        abs_base = np.abs(base)
        
        # 计算幂运算，避免负数的非整数次幂
        result = sign_base * np.power(np.maximum(abs_base, 1e-8), np.abs(exponent))
        
        return result
    
    def _compute_alpha085(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#085: (rank(correlation(((high * 0.876703) + (close * (1 - 0.876703))), adv30, 9.61331))^rank(correlation(ts_rank(((high + low) / 2), 3.70596), ts_rank(volume, 10.1595), 7.11408)))
        """
        high = data['high']
        close = data['close']
        low = data['low']
        volume = data['volume']
        # 使用adv20作为adv30的代理
        adv30 = data['adv20']
        
        # (high * 0.876703) + (close * (1 - 0.876703))
        weighted_price1 = high * 0.876703 + close * (1 - 0.876703)
        
        # correlation(..., 10) - 四舍五入9.61331
        corr1 = self.operators.ts_corr(weighted_price1, adv30, 10)
        
        # rank(...)
        rank1 = self.cross_ops.rank(corr1)
        
        # (high + low) / 2
        mid_price = (high + low) / 2.0
        
        # ts_rank(..., 4) - 四舍五入3.70596
        ts_rank_mid = self.operators.ts_rank(mid_price, 4)
        
        # ts_rank(volume, 10) - 四舍五入10.1595
        ts_rank_volume = self.operators.ts_rank(volume, 10)
        
        # correlation(..., 7) - 四舍五入7.11408
        corr2 = self.operators.ts_corr(ts_rank_mid, ts_rank_volume, 7)
        
        # rank(...)
        rank2 = self.cross_ops.rank(corr2)
        
        # rank(...)^rank(...)
        result = np.power(np.maximum(rank1, 1e-8), rank2)
        
        return result
    
    def _compute_alpha086(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#086: ((ts_rank(correlation(close, sum(adv20, 14.7444), 6.00049), 20.4195) < rank(((open + close) - (vwap + open)))) * -1)
        """
        close = data['close']
        open_price = data['open']
        vwap = data['vwap']
        adv20 = data['adv20']
        
        # sum(adv20, 15) - 四舍五入14.7444
        sum_adv20 = self.operators.ts_sum(adv20, 15)
        
        # correlation(..., 6) - 四舍五入6.00049
        corr = self.operators.ts_corr(close, sum_adv20, 6)
        
        # ts_rank(..., 20) - 四舍五入20.4195
        ts_rank_corr = self.operators.ts_rank(corr, 20)
        
        # (open + close) - (vwap + open)
        price_diff = (open_price + close) - (vwap + open_price)
        
        # rank(...)
        rank_diff = self.cross_ops.rank(price_diff)
        
        # 比较运算
        condition = ts_rank_corr < rank_diff
        
        result = condition.astype(np.float64) * -1.0
        
        return result
    
    def _compute_alpha087(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#087: (max(rank(decay_linear(delta(((close * 0.369701) + (vwap * (1 - 0.369701))), 1.91233), 2.65461)), ts_rank(decay_linear(abs(correlation(IndNeutralize(adv81, IndClass.industry), close, 13.4132)), 4.89768), 14.4535)) * -1)
        """
        close = data['close']
        vwap = data['vwap']
        # 使用adv20作为adv81的代理
        adv81 = data['adv20']
        
        # (close * 0.369701) + (vwap * (1 - 0.369701))
        weighted_price = close * 0.369701 + vwap * (1 - 0.369701)
        
        # delta(..., 2) - 四舍五入1.91233
        delta_price = self.operators.delta(weighted_price, 2)
        
        # decay_linear(..., 3) - 四舍五入2.65461
        decay1 = self.operators.ts_mean(delta_price, 3)
        
        # rank(...)
        rank1 = self.cross_ops.rank(decay1)
        
        # 简化版本：不进行行业中性化，直接使用标准化
        neutralized_adv81 = self.cross_ops.scale(adv81)
        
        # correlation(..., 13) - 四舍五入13.4132
        corr = self.operators.ts_corr(neutralized_adv81, close, 13)
        
        # abs(...)
        abs_corr = np.abs(corr)
        
        # decay_linear(..., 5) - 四舍五入4.89768
        decay2 = self.operators.ts_mean(abs_corr, 5)
        
        # ts_rank(..., 14) - 四舍五入14.4535
        ts_rank_result = self.operators.ts_rank(decay2, 14)
        
        # max(...)
        max_result = np.maximum(rank1, ts_rank_result)
        
        result = max_result * -1.0
        
        return result
    
    def _compute_alpha088(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#088: min(rank(decay_linear(((rank(open) + rank(low)) - (rank(high) + rank(close))), 8.06882)), ts_rank(decay_linear(correlation(ts_rank(close, 8.44728), ts_rank(adv60, 20.6966), 8.01687), 6.65053), 2.61957))
        """
        open_price = data['open']
        low = data['low']
        high = data['high']
        close = data['close']
        # 使用adv20作为adv60的代理
        adv60 = data['adv20']
        
        # rank(open) + rank(low) - (rank(high) + rank(close))
        rank_open = self.cross_ops.rank(open_price)
        rank_low = self.cross_ops.rank(low)
        rank_high = self.cross_ops.rank(high)
        rank_close = self.cross_ops.rank(close)
        
        rank_diff = (rank_open + rank_low) - (rank_high + rank_close)
        
        # decay_linear(..., 8) - 四舍五入8.06882
        decay1 = self.operators.ts_mean(rank_diff, 8)
        
        # rank(...)
        rank1 = self.cross_ops.rank(decay1)
        
        # ts_rank(close, 8) - 四舍五入8.44728
        ts_rank_close = self.operators.ts_rank(close, 8)
        
        # ts_rank(adv60, 21) - 四舍五入20.6966
        ts_rank_adv60 = self.operators.ts_rank(adv60, 21)
        
        # correlation(..., 8) - 四舍五入8.01687
        corr = self.operators.ts_corr(ts_rank_close, ts_rank_adv60, 8)
        
        # decay_linear(..., 7) - 四舍五入6.65053
        decay2 = self.operators.ts_mean(corr, 7)
        
        # ts_rank(..., 3) - 四舍五入2.61957
        ts_rank_result = self.operators.ts_rank(decay2, 3)
        
        # min(...)
        result = np.minimum(rank1, ts_rank_result)
        
        return result
    
    def _compute_alpha089(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#089: (ts_rank(decay_linear(correlation(((low * 0.967285) + (low * (1 - 0.967285))), adv10, 6.94279), 5.51607), 3.79744) - ts_rank(decay_linear(delta(IndNeutralize(vwap, IndClass.industry), 3.48158), 10.1466), 15.3012))
        """
        low = data['low']
        vwap = data['vwap']
        # 使用adv20作为adv10的代理
        adv10 = data['adv20']
        
        # (low * 0.967285) + (low * (1 - 0.967285)) = low
        # 这个公式实际上就是low本身
        weighted_low = low
        
        # correlation(..., 7) - 四舍五入6.94279
        corr = self.operators.ts_corr(weighted_low, adv10, 7)
        
        # decay_linear(..., 6) - 四舍五入5.51607
        decay1 = self.operators.ts_mean(corr, 6)
        
        # ts_rank(..., 4) - 四舍五入3.79744
        ts_rank1 = self.operators.ts_rank(decay1, 4)
        
        # 简化版本：不进行行业中性化，直接使用标准化
        neutralized_vwap = self.cross_ops.scale(vwap)
        
        # delta(..., 3) - 四舍五入3.48158
        delta_vwap = self.operators.delta(neutralized_vwap, 3)
        
        # decay_linear(..., 10) - 四舍五入10.1466
        decay2 = self.operators.ts_mean(delta_vwap, 10)
        
        # ts_rank(..., 15) - 四舍五入15.3012
        ts_rank2 = self.operators.ts_rank(decay2, 15)
        
        result = ts_rank1 - ts_rank2
        
        return result
    
    def _compute_alpha090(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#090: ((rank((close - ts_max(close, 4.66719)))^ts_rank(correlation(IndNeutralize(adv40, IndClass.subindustry), low, 5.38375), 3.21856)) * -1)
        """
        close = data['close']
        low = data['low']
        # 使用adv20作为adv40的代理
        adv40 = data['adv20']
        
        # ts_max(close, 5) - 四舍五入4.66719
        ts_max_close = self.operators.ts_max(close, 5)
        
        # close - ts_max(close, 5)
        close_diff = close - ts_max_close
        
        # rank(...)
        rank_diff = self.cross_ops.rank(close_diff)
        
        # 简化版本：不进行行业中性化，直接使用标准化
        neutralized_adv40 = self.cross_ops.scale(adv40)
        
        # correlation(..., 5) - 四舍五入5.38375
        corr = self.operators.ts_corr(neutralized_adv40, low, 5)
        
        # ts_rank(..., 3) - 四舍五入3.21856
        ts_rank_corr = self.operators.ts_rank(corr, 3)
        
        # rank(...)^ts_rank(...)
        powered = np.power(np.maximum(rank_diff, 1e-8), ts_rank_corr)
        
        result = powered * -1.0
        
        return result
    
    def _compute_alpha091(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#091: ((ts_rank(decay_linear(decay_linear(correlation(IndNeutralize(close, IndClass.industry), volume, 9.74928), 16.398), 3.83219), 4.8667) - rank(decay_linear(correlation(vwap, adv30, 4.01303), 2.6809))) * -1)
        """
        close = data['close']
        volume = data['volume']
        vwap = data['vwap']
        # 使用adv20作为adv30的代理
        adv30 = data['adv20']
        
        # 简化版本：不进行行业中性化，直接使用标准化
        neutralized_close = self.cross_ops.scale(close)
        
        # correlation(..., 10) - 四舍五入9.74928
        corr1 = self.operators.ts_corr(neutralized_close, volume, 10)
        
        # decay_linear(..., 16) - 四舍五入16.398
        decay1 = self.operators.ts_mean(corr1, 16)
        
        # decay_linear(..., 4) - 四舍五入3.83219
        decay2 = self.operators.ts_mean(decay1, 4)
        
        # ts_rank(..., 5) - 四舍五入4.8667
        ts_rank1 = self.operators.ts_rank(decay2, 5)
        
        # correlation(vwap, adv30, 4) - 四舍五入4.01303
        corr2 = self.operators.ts_corr(vwap, adv30, 4)
        
        # decay_linear(..., 3) - 四舍五入2.6809
        decay3 = self.operators.ts_mean(corr2, 3)
        
        # rank(...)
        rank2 = self.cross_ops.rank(decay3)
        
        result = (ts_rank1 - rank2) * -1.0
        
        return result
    
    def _compute_alpha092(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#092: min(ts_rank(decay_linear(((((high + low) / 2) + close) < (low + open)), 14.7221), 18.8683), ts_rank(decay_linear(correlation(rank(low), rank(adv30), 7.58555), 6.94024), 6.80584))
        """
        high = data['high']
        low = data['low']
        close = data['close']
        open_price = data['open']
        # 使用adv20作为adv30的代理
        adv30 = data['adv20']
        
        # ((high + low) / 2) + close
        price_sum = (high + low) / 2.0 + close
        
        # low + open
        low_open_sum = low + open_price
        
        # (...) < (low + open)
        condition = price_sum < low_open_sum
        
        # decay_linear(..., 15) - 四舍五入14.7221
        decay1 = self.operators.ts_mean(condition.astype(np.float64), 15)
        
        # ts_rank(..., 19) - 四舍五入18.8683
        ts_rank1 = self.operators.ts_rank(decay1, 19)
        
        # rank(low), rank(adv30)
        rank_low = self.cross_ops.rank(low)
        rank_adv30 = self.cross_ops.rank(adv30)
        
        # correlation(..., 8) - 四舍五入7.58555
        corr = self.operators.ts_corr(rank_low, rank_adv30, 8)
        
        # decay_linear(..., 7) - 四舍五入6.94024
        decay2 = self.operators.ts_mean(corr, 7)
        
        # ts_rank(..., 7) - 四舍五入6.80584
        ts_rank2 = self.operators.ts_rank(decay2, 7)
        
        # min(...)
        result = np.minimum(ts_rank1, ts_rank2)
        
        return result
    
    def _compute_alpha093(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#093: (ts_rank(decay_linear(correlation(IndNeutralize(vwap, IndClass.industry), adv81, 17.4193), 19.848), 7.54455) / rank(decay_linear(delta(((close * 0.524434) + (vwap * (1 - 0.524434))), 2.77377), 16.2664)))
        """
        vwap = data['vwap']
        close = data['close']
        # 使用adv20作为adv81的代理
        adv81 = data['adv20']
        
        # 简化版本：不进行行业中性化，直接使用标准化
        neutralized_vwap = self.cross_ops.scale(vwap)
        
        # correlation(..., 17) - 四舍五入17.4193
        corr = self.operators.ts_corr(neutralized_vwap, adv81, 17)
        
        # decay_linear(..., 20) - 四舍五入19.848
        decay1 = self.operators.ts_mean(corr, 20)
        
        # ts_rank(..., 8) - 四舍五入7.54455
        ts_rank_result = self.operators.ts_rank(decay1, 8)
        
        # (close * 0.524434) + (vwap * (1 - 0.524434))
        weighted_price = close * 0.524434 + vwap * (1 - 0.524434)
        
        # delta(..., 3) - 四舍五入2.77377
        delta_price = self.operators.delta(weighted_price, 3)
        
        # decay_linear(..., 16) - 四舍五入16.2664
        decay2 = self.operators.ts_mean(delta_price, 16)
        
        # rank(...)
        rank_result = self.cross_ops.rank(decay2)
        
        result = ts_rank_result / np.maximum(rank_result, 1e-8)
        
        return result
    
    def _compute_alpha094(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#094: ((rank((vwap - ts_min(vwap, 11.5783)))^ts_rank(correlation(ts_rank(vwap, 19.6462), ts_rank(adv60, 4.02992), 18.0926), 2.70756)) * -1)
        """
        vwap = data['vwap']
        # 使用adv20作为adv60的代理
        adv60 = data['adv20']
        
        # ts_min(vwap, 12) - 四舍五入11.5783
        ts_min_vwap = self.operators.ts_min(vwap, 12)
        
        # vwap - ts_min(vwap, 12)
        vwap_diff = vwap - ts_min_vwap
        
        # rank(...)
        rank_diff = self.cross_ops.rank(vwap_diff)
        
        # ts_rank(vwap, 20) - 四舍五入19.6462
        ts_rank_vwap = self.operators.ts_rank(vwap, 20)
        
        # ts_rank(adv60, 4) - 四舍五入4.02992
        ts_rank_adv60 = self.operators.ts_rank(adv60, 4)
        
        # correlation(..., 18) - 四舍五入18.0926
        corr = self.operators.ts_corr(ts_rank_vwap, ts_rank_adv60, 18)
        
        # ts_rank(..., 3) - 四舍五入2.70756
        ts_rank_corr = self.operators.ts_rank(corr, 3)
        
        # rank(...)^ts_rank(...)
        powered = np.power(np.maximum(rank_diff, 1e-8), ts_rank_corr)
        
        result = powered * -1.0
        
        return result
    
    def _compute_alpha095(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#095: (rank((open - ts_min(open, 12.4105))) < ts_rank((rank(correlation(sum(((high + low) / 2), 19.1351), sum(adv40, 19.1351), 12.8742))^5), 11.7584))
        """
        open_price = data['open']
        high = data['high']
        low = data['low']
        # 使用adv20作为adv40的代理
        adv40 = data['adv20']
        
        # ts_min(open, 12) - 四舍五入12.4105
        ts_min_open = self.operators.ts_min(open_price, 12)
        
        # open - ts_min(open, 12)
        open_diff = open_price - ts_min_open
        
        # rank(...)
        rank_open_diff = self.cross_ops.rank(open_diff)
        
        # (high + low) / 2
        mid_price = (high + low) / 2.0
        
        # sum(..., 19) - 四舍五入19.1351
        sum_mid = self.operators.ts_sum(mid_price, 19)
        sum_adv40 = self.operators.ts_sum(adv40, 19)
        
        # correlation(..., 13) - 四舍五入12.8742
        corr = self.operators.ts_corr(sum_mid, sum_adv40, 13)
        
        # rank(...)
        rank_corr = self.cross_ops.rank(corr)
        
        # rank(...)^5
        powered = np.power(np.maximum(rank_corr, 1e-8), 5)
        
        # ts_rank(..., 12) - 四舍五入11.7584
        ts_rank_powered = self.operators.ts_rank(powered, 12)
        
        # 比较运算
        result = (rank_open_diff < ts_rank_powered).astype(np.float64)
        
        return result
    
    def _compute_alpha096(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#096: (max(ts_rank(decay_linear(correlation(rank(vwap), rank(volume), 3.83878), 4.16783), 8.38151), ts_rank(decay_linear(ts_argmax(correlation(ts_rank(close, 7.45404), ts_rank(adv60, 4.13242), 3.65459), 12.6556), 14.0365), 13.4143)) * -1)
        """
        vwap = data['vwap']
        volume = data['volume']
        close = data['close']
        # 使用adv20作为adv60的代理
        adv60 = data['adv20']
        
        # rank(vwap), rank(volume)
        rank_vwap = self.cross_ops.rank(vwap)
        rank_volume = self.cross_ops.rank(volume)
        
        # correlation(..., 4) - 四舍五入3.83878
        corr1 = self.operators.ts_corr(rank_vwap, rank_volume, 4)
        
        # decay_linear(..., 4) - 四舍五入4.16783
        decay1 = self.operators.ts_mean(corr1, 4)
        
        # ts_rank(..., 8) - 四舍五入8.38151
        ts_rank1 = self.operators.ts_rank(decay1, 8)
        
        # ts_rank(close, 7) - 四舍五入7.45404
        ts_rank_close = self.operators.ts_rank(close, 7)
        
        # ts_rank(adv60, 4) - 四舍五入4.13242
        ts_rank_adv60 = self.operators.ts_rank(adv60, 4)
        
        # correlation(..., 4) - 四舍五入3.65459
        corr2 = self.operators.ts_corr(ts_rank_close, ts_rank_adv60, 4)
        
        # ts_argmax(..., 13) - 四舍五入12.6556
        ts_argmax_result = self.operators.ts_argmax(corr2, 13)
        
        # decay_linear(..., 14) - 四舍五入14.0365
        decay2 = self.operators.ts_mean(ts_argmax_result, 14)
        
        # ts_rank(..., 13) - 四舍五入13.4143
        ts_rank2 = self.operators.ts_rank(decay2, 13)
        
        # max(...)
        max_result = np.maximum(ts_rank1, ts_rank2)
        
        result = max_result * -1.0
        
        return result
    
    def _compute_alpha097(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#097: ((rank(decay_linear(delta(IndNeutralize(((low * 0.721001) + (vwap * (1 - 0.721001))), IndClass.industry), 3.3705), 20.4523)) - ts_rank(decay_linear(ts_rank(correlation(ts_rank(low, 7.87871), ts_rank(adv60, 17.255), 4.97547), 18.5925), 15.7152), 6.71659)) * -1)
        """
        low = data['low']
        vwap = data['vwap']
        # 使用adv20作为adv60的代理
        adv60 = data['adv20']
        
        # (low * 0.721001) + (vwap * (1 - 0.721001))
        weighted_price = low * 0.721001 + vwap * (1 - 0.721001)
        
        # 简化版本：不进行行业中性化，直接使用标准化
        neutralized_price = self.cross_ops.scale(weighted_price)
        
        # delta(..., 3) - 四舍五入3.3705
        delta_price = self.operators.delta(neutralized_price, 3)
        
        # decay_linear(..., 20) - 四舍五入20.4523
        decay1 = self.operators.ts_mean(delta_price, 20)
        
        # rank(...)
        rank1 = self.cross_ops.rank(decay1)
        
        # ts_rank(low, 8) - 四舍五入7.87871
        ts_rank_low = self.operators.ts_rank(low, 8)
        
        # ts_rank(adv60, 17) - 四舍五入17.255
        ts_rank_adv60 = self.operators.ts_rank(adv60, 17)
        
        # correlation(..., 5) - 四舍五入4.97547
        corr = self.operators.ts_corr(ts_rank_low, ts_rank_adv60, 5)
        
        # ts_rank(..., 19) - 四舍五入18.5925
        ts_rank_corr = self.operators.ts_rank(corr, 19)
        
        # decay_linear(..., 16) - 四舍五入15.7152
        decay2 = self.operators.ts_mean(ts_rank_corr, 16)
        
        # ts_rank(..., 7) - 四舍五入6.71659
        ts_rank2 = self.operators.ts_rank(decay2, 7)
        
        result = (rank1 - ts_rank2) * -1.0
        
        return result
    
    def _compute_alpha098(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#098: (rank(decay_linear(correlation(vwap, sum(adv5, 26.4719), 4.58418), 7.18088)) - rank(decay_linear(ts_rank(ts_argmin(correlation(rank(open), rank(adv15), 20.8187), 8.62571), 6.95668), 8.07206)))
        """
        vwap = data['vwap']
        open_price = data['open']
        # 使用adv20作为adv5和adv15的代理
        adv5 = data['adv20']
        adv15 = data['adv20']
        
        # sum(adv5, 26) - 四舍五入26.4719
        sum_adv5 = self.operators.ts_sum(adv5, 26)
        
        # correlation(..., 5) - 四舍五入4.58418
        corr1 = self.operators.ts_corr(vwap, sum_adv5, 5)
        
        # decay_linear(..., 7) - 四舍五入7.18088
        decay1 = self.operators.ts_mean(corr1, 7)
        
        # rank(...)
        rank1 = self.cross_ops.rank(decay1)
        
        # rank(open), rank(adv15)
        rank_open = self.cross_ops.rank(open_price)
        rank_adv15 = self.cross_ops.rank(adv15)
        
        # correlation(..., 21) - 四舍五入20.8187
        corr2 = self.operators.ts_corr(rank_open, rank_adv15, 21)
        
        # ts_argmin(..., 9) - 四舍五入8.62571
        ts_argmin_result = self.operators.ts_argmin(corr2, 9)
        
        # ts_rank(..., 7) - 四舍五入6.95668
        ts_rank_argmin = self.operators.ts_rank(ts_argmin_result, 7)
        
        # decay_linear(..., 8) - 四舍五入8.07206
        decay2 = self.operators.ts_mean(ts_rank_argmin, 8)
        
        # rank(...)
        rank2 = self.cross_ops.rank(decay2)
        
        result = rank1 - rank2
        
        return result
    
    def _compute_alpha099(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#099: ((rank(correlation(sum(((high + low) / 2), 19.8975), sum(adv60, 19.8975), 8.8136)) < rank(correlation(low, volume, 6.28259))) * -1)
        """
        high = data['high']
        low = data['low']
        volume = data['volume']
        # 使用adv20作为adv60的代理
        adv60 = data['adv20']
        
        # (high + low) / 2
        mid_price = (high + low) / 2.0
        
        # sum(..., 20) - 四舍五入19.8975
        sum_mid = self.operators.ts_sum(mid_price, 20)
        sum_adv60 = self.operators.ts_sum(adv60, 20)
        
        # correlation(..., 9) - 四舍五入8.8136
        corr1 = self.operators.ts_corr(sum_mid, sum_adv60, 9)
        
        # rank(...)
        rank1 = self.cross_ops.rank(corr1)
        
        # correlation(low, volume, 6) - 四舍五入6.28259
        corr2 = self.operators.ts_corr(low, volume, 6)
        
        # rank(...)
        rank2 = self.cross_ops.rank(corr2)
        
        # 比较运算
        condition = rank1 < rank2
        
        result = condition.astype(np.float64) * -1.0
        
        return result
    
    def _compute_alpha100(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#100: (0 - (1 * (((1.5 * scale(IndNeutralize(IndNeutralize(rank(((((close - low) - (high - close)) / (high - low)) * volume)), IndClass.subindustry), IndClass.subindustry))) - scale(IndNeutralize((correlation(close, rank(adv20), 5) - rank(vwap)), IndClass.sector))) * (volume / adv20))))
        """
        close = data['close']
        high = data['high']
        low = data['low']
        volume = data['volume']
        vwap = data['vwap']
        adv20 = data['adv20']
        
        # ((close - low) - (high - close)) / (high - low)
        price_momentum = ((close - low) - (high - close)) / np.maximum(high - low, 1e-8)
        
        # (...) * volume
        volume_weighted = price_momentum * volume
        
        # rank(...)
        rank_volume_weighted = self.cross_ops.rank(volume_weighted)
        
        # 简化版本：不进行行业中性化，直接使用标准化
        neutralized1 = self.cross_ops.scale(rank_volume_weighted)
        
        # 1.5 * scale(...)
        first_term = 1.5 * neutralized1
        
        # correlation(close, rank(adv20), 5)
        rank_adv20 = self.cross_ops.rank(adv20)
        corr = self.operators.ts_corr(close, rank_adv20, 5)
        
        # rank(vwap)
        rank_vwap = self.cross_ops.rank(vwap)
        
        # correlation(...) - rank(vwap)
        corr_diff = corr - rank_vwap
        
        # 简化版本：不进行行业中性化，直接使用标准化
        neutralized2 = self.cross_ops.scale(corr_diff)
        
        # volume / adv20
        vol_ratio = volume / np.maximum(adv20, 1e-8)
        
        # 组合
        combined = (first_term - neutralized2) * vol_ratio
        
        result = -1.0 * combined
        
        return result
    
    def _compute_alpha101(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        Alpha#101: ((close - open) / ((high - low) + .001))
        """
        close = data['close']
        open_price = data['open']
        high = data['high']
        low = data['low']
        
        # close - open
        price_change = close - open_price
        
        # high - low + 0.001
        price_range = (high - low) + 0.001
        
        # (close - open) / ((high - low) + 0.001)
        result = price_change / price_range
        
        return result


class AlphaFactor:
    """
    单个Alpha因子的封装类
    """
    
    def __init__(self, factor_id: str, factory: Alpha101Factory):
        """
        初始化因子
        
        Parameters:
        -----------
        factor_id : str
            因子ID
        factory : Alpha101Factory
            因子工厂实例
        """
        self.factor_id = factor_id
        self.factory = factory
        self.config = get_factor_config(factor_id)
        
        # 验证配置
        if not validate_factor_config(factor_id):
            raise ValueError(f"Invalid configuration for factor {factor_id}")
    
    @property
    def formula(self) -> str:
        """因子公式"""
        return self.config['formula']
    
    @property
    def dependencies(self) -> List[str]:
        """数据依赖项"""
        return self.config['dependencies']
    
    @property
    def window(self) -> int:
        """时间窗口"""
        return self.config['window']
    
    @property
    def description(self) -> str:
        """因子描述"""
        return self.config['description']
    
    @property
    def category(self) -> str:
        """因子类别"""
        return self.config['category']
    
    def compute(self, data: Dict[str, np.ndarray], **kwargs) -> np.ndarray:
        """
        计算因子值
        
        Parameters:
        -----------
        data : Dict[str, np.ndarray]
            输入数据
        **kwargs
            额外参数
            
        Returns:
        --------
        np.ndarray
            因子值
        """
        return self.factory.compute_factor(self.factor_id, data, **kwargs)
    
    def validate_result(self, result: np.ndarray) -> bool:
        """
        验证计算结果
        
        Parameters:
        -----------
        result : np.ndarray
            计算结果
            
        Returns:
        --------
        bool
            结果是否有效
        """
        if not isinstance(result, np.ndarray):
            return False
        
        if result.ndim != 2:
            return False
        
        # 检查是否全为NaN
        if np.all(np.isnan(result)):
            return False
        
        # 检查是否有无穷大值
        if np.any(np.isinf(result)):
            return False
        
        return True
    
    def __repr__(self) -> str:
        return f"AlphaFactor(id='{self.factor_id}', category='{self.category}')"
    
    def __str__(self) -> str:
        return f"{self.factor_id}: {self.description}"